Redirecting Pages through CGIProxy with Squid

View Markdown Other Articles

Article written by a human: Mike Cardwell

There are a number of legal to use publicly accessible installations of CGIProxy. They're usually quite fast and some even have SSL certificates. One of my favourites is CTunnel https://www.ctunnel.com/ (broken link nowadays).

On my network I use a Squid HTTP proxy. I thought that it would be nice if I could configure Squid to redirect certain HTTP requests through CTunnel, eg requests for http://www.torrentreactor.net/ to hide my IP address from the destination site and therefore logs.

To do this, I abused the Squid access controls and deny_info options. These options were designed so you could block requests for certain pages, and redirect the user to a failure page which explains why the request was blocked. First of all I created a file at /etc/squid/ctunnel_list.txt which contained a list of regular expressions of HTTP requests I want to redirect:

root@server:/etc/squid# head -1 ctunnel_list.txt
^http\:\/\/([^\/]+\.)*torrentreactor\.net\/

Then I added the following configuration to /etc/squid/squid.conf:

acl         ctunnel_list url_regex -i "/etc/squid/ctunnel_list.txt"
http_access deny         ctunnel_list
deny_info   https://www.ctunnel.com/index.php/1010110A/?username=%s ctunnel_list

Now when my web browser makes any request for any url on torrentreactor.net or any of the other regular expressions in my ctunnel_list.txt file, Squid redirects me to a version proxied through https://www.ctunnel.com/ Magic


· PayPal · Patreon · Bitcoin RSS · Atom · Mastodon · Bluesky
← Read more