Redhat – Squid cant resolve local server address from RedHat Linux Server

domain-name-systemredhatsquid

I have a very curious problem on my RedHat linux Server. I have a Squid proxy server installed and operating wonderfully for WAN addresses. However when I try to access my local MediaWiki system I get

The requested URL could not be retrieved
The following error was encountered: Unable to determine IP address from host name for ServerName

When I restart squid I am able to access these local addresses for about 5 minutes, but then this same message comes back. Now I have verified that I can ping ServerName just fine, so the name resolution isn't actually the issue.

I have also added the lines to my squid.conf, which all the instructions I find online seem to indicate should solve the issue.

acl ServerName dstdomain DomainName
always_direct allow ServerName

(NOTE: Names have been changed to protect the innocent)

I then also added:

acl MyDomain src 192.168.0.1/255.255.255.192
never_direct deny MyDomain

Same result (And there was some weird message from aclParseIpData warning me about my netmask making away part of my specified IP), which I thought was a very odd message indeed.

Best Answer

The right answer for this was to modify my proxy.pac, and wpad.dat files. Instead of just saying:

function FindProxyForURL(url,host)
{

 return "PROXY 192.168.0.XX:3128; DIRECT";
}

instead I have to modify it so when machines saw that it was a local machines host name and not a URL they didnt try to use the proxy. The isPlainHostName function worked perfectly. The code I used is:

function FindProxyForURL(url,host)
{
  if(isPlainHostName(host))
        return "DIRECT";

  return "PROXY 192.168.0.XX:3128; DIRECT";
}

It was just me being ignorant of how to properly use the .pac file to direct users to local addresses.

Related Topic