Can't get Squid to use /etc/hosts to resolve hostnames

From: Danny Cecil <danny.cecil@dont-contact.us>
Date: Wed, 22 Mar 2000 12:38:27 -0800

I'm using Squid 2.3 Stable 1 on a Red Hat Linux 6.1 system as an httpd
accelerator for our web site. We are running into a problem when the web
server tries to return a redirected URL. It returns the server name passed
by Squid (httpd_accel_host) instead of the virtual server name (that maps to
our LocalDirector). Since our firewall does not allow direct access to the
web servers, these redirected links fail. In searching the Squid mailing
list archives, I discovered that other people have run into the same
problem. The recommended solution was this:
 
1. Rebuild your squid with -disable-internal-dns
2. Change /etc/hosts to list your real webservers IP for
www.something.nl <http://www.something.nl/>
3. Modify /etc/nsswitch.conf to prefer files over NDS for host lookups.
4. Change squid.conf to httpd_accel_host www.something.nl
<http://www.something.nl/>
 
I've done all of this, and now when I try to go to www.deepcanyon.com
<http://www.deepcanyon.com/> (on a test system) I get the following error
message from Squid:
 
"The requested URL could not be retrieved
 
----------------------------------------------------------------------------

----
 
While trying to retrieve the URL: http://www.deepcanyon.com/ 
 
The following error was encountered: 
 
Unable to determine IP address from host name for www.deepcanyon.com 
The dnsserver 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. 
 Check if the address is correct. "
 
The name www.deepcanyon.com <http://www.deepcanyon.com/>  is in my
/etc/hosts file.  From the command prompt I can telnet, ping, etc. and the
name resolves just fine.  Am I missing some step here?  I've been over and
over the various config files (squid.conf, resolv.conf, nsswitch.conf) and
everything looks fine.  Anyone have any suggestions?
 
-Danny Cecil
 
Received on Wed Mar 22 2000 - 13:37:13 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:52:21 MST