Cache peer configuration for squid

From Notes_Wiki

Home > CentOS > CentOS 6.x > Squid proxy server configuration > Cache peer configuration for squid

Configuring cache peer for complete browsing

We can configure parent proxy such that all requests always go through parent proxy only. This is useful in setting up proxy server when the proxy server itself does not has direct access to Internet. This is also useful is supplying username and password to parent proxy, while creating a local proxy server which does not requires authentication.

cache_peer 10.4.3.204 parent 8080 7 no-query no-digest no-netdb-exchange
prefer_direct off
never_direct allow all

Here replace '10.4.3.204' with parent proxy address and '8080' with parent proxy port. To supply authentication also add option 'login=user:password' as

cache_peer 10.4.3.204 parent 8080 7 no-query no-digest no-netdb-exchange login=saurabh:secret


Configuring cache peer for some specific domains

We can configure parent proxy for few specific domains. This can be useful if parent proxy is registered with special access on those domains. For example proxy server IP can be registered on some journal websites and we may want to use parent proxy for opening only those journal websites. All other websites can be opened directly by proxy using its own Internet connection.

Sample configuration which can achieve above requirement is:

cache_peer 10.4.3.204 parent 8080 7 no-query no-digest no-netdb-exchange
prefer_direct on
acl journal-sites dstdomain ieeexplore.ieee.org acm.org springerlink.com pubs.asce.org sciencedirect.com  epw.in
never_direct allow journal-sites
never_direct deny all


Home > CentOS > CentOS 6.x > Squid proxy server configuration > Cache peer configuration for squid