[squid-users] Squid not using hosts file

Alex Rousskov rousskov at measurement-factory.com
Sat May 8 14:49:14 UTC 2021


On 5/7/21 10:16 PM, Jazmine Redmond wrote:
> The problem was in the hosts file. Each new line should begin with the
> IP address, followed by one or more spaces, followed by a name.
> My hosts file had a space before the IP address. Once I removed the
> space at the beginning of the line, everything worked fine.

If a supported Squid version does not at least log ERROR messages about
(what it considers) malformed /etc/hosts lines, please consider filing a
bug report with Squid bugzilla. This problem is not something admins
should be guessing on their own, and surprising interpretation of
/etc/hosts file may have security implications in some environments.


> I downgraded my Squid to a supported version v2.7 so I can confirm it
> works on this version. I have not upgraded to v3.5 yet... perhaps in the
> future.

Please note that there has been no work on Squid v2 for about 10 years.
Those ancient versions are full of security vulnerabilities and are not
supported by the Squid Project in any shape or form.

Alex.


> On Fri, May 7, 2021 at 2:01 PM Jazmine Redmond wrote:
> 
>     Thanks for the reply.
>     You mentioned supported Squid versions. For Windows I see Squid
>     versions 3.5, 3.3 and 2.7. Which ones are supported?
>     Additionally, what are the supported versions for Linux? 
> 
>     Jazmine
> 
>     On Thu, May 6, 2021 at 7:04 AM Alex Rousskov wrote:
> 
>         On 5/6/21 12:09 AM, Jazmine Redmond wrote:
>         > Hi, 
>         >
>         > I am having issues getting Squid to use the hosts file on the
>         squid server.
>         >  
>         > I added the hosts_file configuration directive to my squid
>         config file
>         > as follows:
>         >  
>         > hosts_file  C:/Windows/System32/drivers/etc/hosts
>         >  
>         > But, when my squid client browser specifies a URL with a
>         machine name
>         > listed in the hosts file, squid returns an error that says:
>         >  
>         > “Unable to determine IP address from host name. The DNS server
>         returned:
>         > Name Error: the domain name does not exist. This means that
>         the cache
>         > was not able to resolve the hostname presented in the URL.”
>         >  
>         > So, it seems that squid is NOT using my hosts file.
>         >  
>         > I have tried using forward slashes (/) and backward slashes
>         (\) in the
>         > hosts_file configuration directive, yet the error persists.
>         >  
>         > I have verified the path to the hosts file is correct and I
>         restart
>         > Squid each time I make edits to the configuration file. Yet
>         the error
>         > persists.
>         >  
>         > I am running Squid version 3.5.28 on Windows 10.
>         >  
>         > Am I missing something?
> 
>         Supported Squid versions are known to use /etc/hosts file. I do
>         not know
>         whether there are any Windows-specific or v3-specific bugs in
>         that area.
>         Unfortunately, very few people responding on this mailing list
>         are using
>         Squid v3 and Squid on Windows in general. That is probably why
>         you are
>         not getting any responses.
> 
>         If you can try a supported Squid version, please do so
>         (especially if
>         you can try it on Linux). You may also share a pointer to a
>         compressed
>         cache.log after setting debug_options to ALL,9 in case somebody
>         volunteers to help you with triage.
> 
>         Alex.
> 



More information about the squid-users mailing list