Squid

Transparent proxy in squid 2.6

In Squid version 2.6 onward, transparent proxy configuration changed to use:

http_port 3128 transparent

instead of the old configuration, which required many lines, as shown below:

http_port 3128
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on

Also add an iptables REDIRECT rule. Based on the above, configure the transparent proxy as follows: Edit /etc/squid/squid.conf and change the http_port line to:

http_port 3128 transparent

Then restart Squid with:

[root@zylinux ~]# service squid restart

Set up iptables to redirect requests for port 80 to port 3128:

[root@zylinux ~]# iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128

After completing these steps, test it by pointing a client’s gateway to the Squid server you configured. Read more about setting up a Squid transparent proxy with HTTPS support.

EOF.← Back to articles