You use the cache_peer
config option to define a peer or parent, and you use cache_peer_access
to force all requests matching a particular squid acl
to use that peer.
For example:
cache_peer squid2.example.com sibling 3128 3130
acl alwayspeer dstdomain foo.example.com bar.example.com
cache_peer_access squid2.example.com allow alwayspeer
That will force all requests for those two domains (foo.example.com
and bar.example.com
) to go via the peer (squid2.example.com
).
NOTE: alwayspeer
is just an arbitrary name I chose for this acl
.
If you also want to restrict usage of that peer to ONLY the domains listed in the alwayspeer acl, add the following line:
cache_peer_access squid2.example.com deny !alwayspeer
Any squid acl
type can be used, not just dstdomain
. e.g. url_regex
or urlpath_regex
(or dstdom_regex
) if you want the acl to regex match part or all of a URL (or domain).
Finally, multiple acl
s can be allowed or denied with cache_peer_access
rules. Note that the order of rules is significant (first matching rule wins).
always_direct
isnever_direct
. Not kidding. – muru Apr 25 '16 at 3:40