Redirecting Pages through CGIProxy with Squid

Written 8 years ago by 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. A small list of other installations can be seen here.

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 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

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 ctunnel_list

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

Looking to hire somebody like me? I'm open to offers of full time employment and small contract jobs. Check out my hiring page. You can follow this Blog using RSS or . To read more, visit my blog index.

Feeling generous?BitcoinMoneroZcashPaypal