How do I configure Squid to forward all requests to another cache?
FORWARDING ALL REQUESTS TO ANOTHER CACHE
If your Web proxy machine is behind a firewall, it may well be unable to connect to destination webservers. In this instance, it can be useful to setup an internal proxy and forward all requests to a machine outside the firewall or local network.
First, you need to give Squid a parent cache. Second, you need to tell Squid it can not connect directly to origin servers. This is done with three entries in your squid.conf file:
cache_peer parentcache.yourcompany.com parent 3128 0 no-query default
never_direct allow all
This forwards all requests to the parent cache. If the parent (or parents) become unreachable, any Web requests will result in a proxy error.
The alternative to this is to configure multiple parent caches – or, if your network allows it, you can allow Squid to use direct connections only when all the parents go down you:
cache_peer parent.foo.com parent 3128 0 no-query
prefer_direct off
The default behaviour of Squid in the absence of positive ICP, HTCP, etc replies is to connect to the origin server instead of using parents. The prefer_direct offdirective tells Squid to try parents first. With this configuration, if the parent cache fails or becomes unreachable, then every request will result in an error message.
MULTIPLE PARENT CACHES
Squid can be configured to use multiple parent caches, either for resilience or load-balancing. For example:
local_domain mydomain.net
cache_host parent1.foo.com parent 3128 3130 no-query round-robin
cache_host parent2.foo.com parent 3128 3130 no-query round-robin
cache_host parent3.foo.com parent 3128 3130 no-query round-robin
This configures three parent caches, which will be used in round-robin fashion. Each parent cache will receive an equal number of requests. This does not take into account load or weighting for each host.