FolkeHacks - squid forwardmap

squid forwardmap Hack

This is a hack for the squid-proxy 2.5 www.squid-cache.org

Squid can act as a transparent-proxy/accelerator if you redirect your http-traffic with linux-netfilter to the localhost squid-port.
With the forwardmap hack you can do static mapping from original-destination ip:port/path to any other ip:port/path.
The ""Host:"-header will not be used.
This is not for office-to-web proxying, but for web-to-server(s) proxying, filtering or splitting.

There is the new configfile option 'forwardmap':
#forwardmap from_ip/from_mask from_port from_uri to_ip to_port to_uri
forwardmap 80 / 80 /
forwardmap 80 /othersite 80 /
forwardmap 80 /xxx 80 /xxx
forwardmap 80 /abc 80 /
forwardmap 80 / 80 /abc
forwardmap 80 / 80 /

Info: How to patch debian-squid:
# apt-get source squid
# cd squid-2.5.X
# make -f debian/rules patch
# cat path-to/squid-2.5.STABLE5-forwardmap.diff | patch -p1
# make -f debian/rules binary-arch

Patch for squid-2.5: squid-2.5.STABLE5-forwardmap.diff

Back to FolkeHacks


© 1999-2023 by Folke Ashberg | <>