Transparent Squid proxy


How to run squid as a transparent squid proxy :

Squid 2.5 and earlier :

Edit /etc/squid/squid.conf and add this :

httpd_accel_host virtual httpd_accel_port 80 httpd_accel_with_proxy on httpd_accel_uses_host_header on

To enable the transparent proxying, type this :

iptables -t nat -A PREROUTING -i eth0 -s -p tcp --dport 80 -j REDIRECT --to-port 3128

“-s” is optional but needed if you run a webserver on the squid machine. The web visitor request would be piped in squid without it.

Squid 2.6 and later :

Thanks for reading this post!

If you found an issue in this article, you can create an issue on Github.

If you have a comment or question, please drop me a line below!