[squid-users] Configure squid 3.5 to use different parent proxies for different listening ports

Alex Rousskov rousskov at measurement-factory.com
Mon Feb 20 21:26:47 UTC 2017


On 02/20/2017 02:08 PM, Damir Bagapov wrote:

> I need to configure squid in a way when all incoming requests to
> 3128 port will be redirected to proxy1 (as it works now), and all
> incoming requests to 3127 will be redirected to proxy2.

> http_port 3128
> http_port 3127
> 
> acl port_3128 port 3128
> acl port_3127 port 3127
> 
> # 3128
> cache_peer proxy01 parent 3128 0 no-query originserver name=proxy3128
> cache_peer_access proxy3128 allow port_3128
> cache_peer_access proxy3128 deny port_3127
> 
> # 3127 
> cache_peer proxy02 parent 3128 0 no-query originserver name=proxy3127
> cache_peer_access proxy3127 allow port_3127
> cache_peer_access proxy3127 deny port_3128


You probably want to use the "myport" ACLs instead of the "port" ACLs
because you route based on the Squid listening port, not the origin
server listening port.

I hope you do not need those "deny" rules for cache_peer_access
directives because the default -- reverse the last action [for the same
peer] -- should work fine. If you want or need to have explicit deny
rules, use "deny all" to clarify the intent and avoid the "what if none
of the cache_peer_access rules match for a peer?" concerns.


HTH,

Alex.



More information about the squid-users mailing list