Rene Kita's weblog

Blog[0] About[1] RSS[2] Links[3]

Circumventing Clownflare with w3m

2024-05-03

Recently Cloudflare started blocking w3m when visiting any site from the StackExchange network. This was confirmed by multiple users and happened with w3m on Debian, but not with w3m on OpenBSD.

Some debugging showed that curl still worked, so I utilized w3m's siteconf and a CGI script to circumvent the blocking.

The script[4] looks like this:

#!/bin/sh

# Circumvent Clownfare with curl

# Put this file in one of the configured cgi-bin directories of w3m and make
# it executable.
# Add the two next lines your ~/.w3m/siteconf omitting the # at the beginning
#url m!^https?://stackoverflow.com/!
#substitute_url "file:///cgi-bin/anti-cf.cgi?"
#url m!^https?://.*stackexchange.com/!
#substitute_url "file:///cgi-bin/anti-cf.cgi?"

printf "%s\n\n" "Content-Type: text/html"

url=$(echo $W3M_CURRENT_LINK | sed 's@\(http.\{0,1\}://[^/]*\)/.*@\1@')
curl -L ${url}/${QUERY_STRING}

Last modified: 2024-05-03T04:52:52Z

E-mail: mail@rkta.de[5] IRC: #rkta[6] on Libera.Chat[7]

Copyright (c) 2017-2024 Rene Kita

=> [0] Blog | [1] About | [2] RSS | [3] Links | [4] script | [5] mail@rkta.de | [6] #rkta | [7] Libera.Chat

Proxy Information
Original URL
gemini://rkta.srht.site/anti-cf.gmi
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
205.227256 milliseconds
Gemini-to-HTML Time
1.305103 milliseconds

This content has been proxied by September (ba2dc).