Squid – Selective reverse proxy and forward proxy

forwardingreverse-proxysquid

I'd like to setup a squid instance to do selective reverse proxy for a configured list of URLs while acting as a normal forward proxy for everything else.

We are building new infrastructure, parallel live as it were, and I want to have a proxy that people can use that will force selective traffic into the new platform while acting as a forward proxy for anything else. This makes it very easy for people/systems to test the portions of the new platform we want without having to change too much, just use a proxy address.

Is such a setup possible ?

Best Answer

The following seems to work for me, anything for www.myurl.com gets sent to the new servers and everything else is proxied as normal.

# Setup a cache peer as an origin server 
# Duplicate this line for each site you want to reverse for and give it a new name
cache_peer <new platform ip or fqdn> parent 80 0 no-query originserver proxy-only name=upstream1

# Set the domain the cache_peer should handle
cache_peer_domain upstream1 www.myurl.com

# Duplicate following three lines
# Add as many acl lines as necessary for all domains handled
acl our_sites  dstdomain www.myurl.com
cache_peer_access upstream1_sites allow our_sites
cache_peer_access upstream1_sites deny all