WPAD / Proxy

We're setting up a content filter system using Dansguardian + squid. It's working pretty well doing differential filtering based on AD group. The problem we're having right now is that we want everything local to be bypassed, ie: any local domain / ip address etc should not use the proxy at all but all traffic going outside of our network should go through the proxy. Our wpad.dat file is pretty simple


function FindProxyForURL(url, host) {


// If specific URL needs to bypass proxy, send traffic direct.
        if (shExpMatch(url,"*localdomain") ||
            shExpMatch(url,"*.phobos.apple.com.edgesuite.net") ||
            shExpMatch(url,"172*"))
                return "DIRECT";
else
return "PROXY proxyname:8080";
}


So anything matching localdomain in the URL field should not go through the proxy at all, same with urls that begin with 172. Our clients see the proxy and use it just fine but our bypass rules are not working. I have tried a number of different ways and seem to get the same results.


Any ideas?
LVL 1
syscrashAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Keith AlabasterEnterprise ArchitectCommented:
The above makes the assumption that you are setting the web browser proxy settings to the location of the .pac file rather than putting in a specific proxy ip address and port number in the web browser.

Rather than using specific shell expressions, use the more detailed functions provided instead. Something like.....

function FindProxyForURL(url, host)
// Start Function
{

// Leave localhosts services with no proxy (developer/3rd party etc)

if ((host == "localhost") ||
(shExpMatch(host, "localhost.*")) ||
(host == "127.0.0.1"))
{
return "DIRECT";
}

// Check on source IP addresses
// Test to see if host is an IP address on local LANS, VPN or DMZ subnets. If so, don't use proxy.

// Check for an Internal address being targeted
if (isInNet(host, "172.16.0.0", "255.255.0.0"))
{ return "DIRECT"; }

// Check for a DMZ 10.x IP address being targeted
if ((isInNet(host, "10.0.0.0", "255.255.0.0")) || // Anything starting with 10.0 or 10.1
(isInNet(host, "10.1.0.0", "255.255.0.0")))
{ return "DIRECT"; }

// Check for a DMZ IP address being targeted starting with 192.168
if (isInNet(host, "192.168.0.0", "255.255.0.0"))
{ return "DIRECT"; }

// Identify where user is located - area1, area2 etc or over VPN subnet & set the variable called proxy
// Set default value of proxy variable to area1 address then change if area2 proxy address required instead.

proxy = "PROXY proxy_server_ip:8080";

// Remote Offices use area2 proxy

if (isInNet(myIpAddress(), "172.16.73.0", "255.255.255.0")) {proxy = "PROXY area2_proxy_ip:8080"; }
if (isInNet(myIpAddress(), "172.16.87.0", "255.255.255.0")) {proxy = "PROXY area2_proxy_ip:8080"; }

// Other Subnets that need area2 proxy rather than default proxy

if (isInNet(myIpAddress(), "172.16.120.0", "255.255.255.0")) {proxy = "PROXY area2_proxy_ip:8080"; }


// Let local servers using domains called by FQDN to go Direct

if ((dnsDomainIs(host, ".phobos.apple.com.edgesuite.net")) ||
(dnsDomainIs(host, ".microsoft.com")))
{
return "DIRECT";
}

// If a netbios name rather than an FQDN is used, don't use proxy either

if (isPlainHostName(host))
return "Direct";

// Send back the value now within proxy variable to browser based on users's subnet or, if none of the definitive
// rules above have been applicable, send back the default proxy value

return proxy;

// End procedure
}

Save the above as proxy.pac and edit as per your needs. Place the file in the wwwroot folder of one of your IIS boxes then, in the web proxy settings, set the option to use the automatic configuration script located at http://your_web_server/proxy.pac

Job done


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Keith AlabasterEnterprise ArchitectCommented:
Are we done here?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Networking

From novice to tech pro — start learning today.