[squid-users] Redirect request to cache_peer using username and passwords

Amos Jeffries squid3 at treenet.co.nz
Thu Jul 2 14:00:40 UTC 2020

On 3/07/20 12:59 am, Prem Chand wrote:
> Hi Amos,
> Thanks for the response.
> However, what do you want to happen when that user's dedicated peer is
> unavailable?
> Can it be routed to another peer if a dedicated peer is unavailable?
> because each peer is accessed by a different username and password. If
> there is an option to route then I will keep a backup peer(Peer4) so if
> any one of the peers(Peer1,Peer2,Peer3) is unavailable it can route to
> the backup peer and once the unavailable peer become available then
> traffic should auto route to them from backup peer.
> If there is no option that fits as I explained above then I want to stop
> all access for them.
> Are you wanting to keep this behaviour?
> I don't want to use the round-robin behaviour. I want to route requests
> to dedicated Peer/Client.

So what you want requires Squid-3.4 or later and looks something like this:

 auth_param ...
 acl authed proxy_auth REQUIRED
 http_access deny !authed
 http_access allow authed

 acl user1 note user username1
 acl user2 note user username2
 acl user3 note user username3

 # per-user peers first (preferred)
 cache_peer peer1 ...
 cache_peer_access peer1 allow user1
 cache_peer_access peer1 deny all

 cache_peer peer2 ...
 cache_peer_access peer2 allow user2
 cache_peer_access peer2 deny all

 cache_peer peer3 ...
 cache_peer_access peer3 allow user3
 cache_peer_access peer3 deny all

 # last peer for any user (if above are unavailable)
 cache_peer peer4 ...
 cache_peer_access allow all

 # forbid DIRECT traffic
 never_direct allow all


More information about the squid-users mailing list