Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a basic squid configuration that connects to the Internet directly, I need a way to use a parent peer depending on the URL.

So for example:

  • I configure it to use a local proxy that links it to local machines for any URL with .local TLD
  • If a user requests http://www.google.com/ it goes directly to google.com port 80
  • If a user requests http://server1.local/ it goes to a machine on the LAN called server1 using the local proxy.

This is a simplified example that could be solved by DNS, but I'm doing something a little more complicated.

I tried googling for results on this but most of the results are irrelevant. Thanks.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

From the squid FAQ.

The cache_peer_domain directive allows you to specify that certain caches siblings or parents for certain domains:

#  squid.conf - On the host: sv.cache.nlanr.net
#  Format is: hostname  type  http_port  udp_port
cache_peer electraglide.geog.unsw.edu.au parent 3128 3130
cache_peer cache1.nzgate.net.nz          parent 3128 3130
cache_peer pb.cache.nlanr.net   parent 3128 3130
cache_peer it.cache.nlanr.net   parent 3128 3130
cache_peer sd.cache.nlanr.net   parent 3128 3130
cache_peer uc.cache.nlanr.net   sibling 3128 3130
cache_peer bo.cache.nlanr.net   sibling 3128 3130
cache_peer_domain electraglide.geog.unsw.edu.au .au
cache_peer_domain cache1.nzgate.net.nz   .au .aq .fj .nz
cache_peer_domain pb.cache.nlanr.net     .uk .de .fr .no .se .it
cache_peer_domain it.cache.nlanr.net     .uk .de .fr .no .se .it
cache_peer_domain sd.cache.nlanr.net     .mx .za .mu .zm

The configuration above indicates that the cache will use pb.cache.nlanr.net and it.cache.nlanr.net for domains uk, de, fr, no, se and it, sd.cache.nlanr.net for domains mx, za, mu and zm, and cache1.nzgate.net.nz for domains au, aq, fj, and nz.

Comments about cache_peer_domain from the example squid configuration file.

#  TAG: cache_peer_domain
#       Use to limit the domains for which a neighbor cache will be
#       queried.  Usage:
#       cache_peer_domain cache-host domain [domain ...]
#       cache_peer_domain cache-host !domain
#       For example, specifying
#               cache_peer_domain parent.foo.net        .edu
#       has the effect such that UDP query packets are sent to
#       'bigserver' only when the requested object exists on a
#       server in the .edu domain.  Prefixing the domain name
#       with '!' means the cache will be queried for objects
#       NOT in that domain.
#       NOTE:   * Any number of domains may be given for a cache-host,
#                 either on the same or separate lines.
#               * When multiple domains are given for a particular
#                 cache-host, the first matched domain is applied.
#               * Cache hosts with no domain restrictions are queried
#                 for all requests.
#               * There are no defaults.
#               * There is also a 'cache_peer_access' tag in the ACL
#                 section.
# none
share|improve this answer
Thanks, I was playing with cache_peer amd acls and that didn't work. –  Osama ALASSIRY Nov 5 '10 at 23:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.