I would like to retrieve certain sites or domains via uplink proxy in squid. I would like to have a list of such sites. How to do that?

I see directive always_direct, but I need opposite: pass all requests directly, but only some of them -- to peer.

Is this possible?

  • 1
    The opposite of always_direct is never_direct. Not kidding.
    – muru
    Commented Apr 25, 2016 at 3:40

1 Answer 1


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 acls can be allowed or denied with cache_peer_access rules. Note that the order of rules is significant (first matching rule wins).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .