Rene Kita's weblog

Blog About RSS Links

Circumventing Clownflare with w3m

Note: At the time of publishing this article I did not get blocked anymore.

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 looks like this:


# 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?://!
#substitute_url "file:///cgi-bin/anti-cf.cgi?"
#url m!^https?://.*!
#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