Daily Archive for January 6th, 2010

Squid, HTTP authentification in accelerator mode

When you use HTTP authentification, like in .htaccess with Apache, by default Squid doesn’t support this feature. You need to add an option, login=PASS,  to the cache_peer to forward HTTP authentification requests to the backend servers:


cache_peer 172.16.1.1 parent 80 0 login=PASS no-query originserver weight=1

How to use differents cache_peer in Squid

In accelerator mode, you can use the same Squid instance with differents cache_peer configuration using acl to choose where requests will go:

acl example2 dstdomain www.example2.com

cache_peer 172.16.1.1 parent 80 0 no-query originserver weight=1 name=clust1

cache_peer 172.16.1.2 parent 80 0 no-query originserver weight=1 name=clust2

cache_peer_access clust1 allow !example2

cache_peer_access clust2 allow example2<code>

Request for the domain www.example2.com go to clust2 (172.16.1.2). However, request for others domain, like www.toto.com go to clust1 (172.16.1.1).