Re: [squid-users] dns-related cache problem (squid 3.3.8)

From: Amos Jeffries <>
Date: Wed, 09 Oct 2013 17:42:08 +1300

On 9/10/2013 9:39 a.m., Dash Four wrote:
> I have the following problem: I use the "hosts" file to store static
> address mappings, usually containing sites which use geo address
> mapping (in other words, determine the ip address one is going to use
> depending on the geographic region the request is made from). One such
> site is youtube for example.
> Squid caches web pages content from these sites, but when I change the
> IP address in "hosts", squid is still using the old IP address for
> some reason, even though I verified that the new mapping is used by
> the system.
> In such cases, I have to stop squid, wipe out the entire cache and
> then restart squid in order for the new host->ip mapping to be used.
> This can't be right!
> What I presume is happening is that somewhere along the line, squid is
> storing clear ip addresses in the cache (probably to speed up serving
> page content requests) and then it does not check whether that ip
> address has changed. If that is so, could this be fixed, because the
> idea of me clearing the entire cache every time I change one of the
> "hosts" mappings does not exactly appeal to me. Thanks.

Sort of. Squid loads the hosts file contents into DNS result cache with
an infinite TTL in order to provide a single lookup mechanism for any
DNS entry and prevent remote lokups of those FQDN. These are only loaded
on startup and reconfigure time.

Squid at this time does not yet have any mechanism for watching the file
for changes (patches welcome!).
If your OS supports a filesystem trigger feature such as inotify or
dnotify you can script up a restart of Squid when hosts changes.

Received on Wed Oct 09 2013 - 04:42:18 MDT

This archive was generated by hypermail 2.2.0 : Thu Oct 10 2013 - 12:00:05 MDT