?
Solved

PAC File not working for one site

Posted on 2011-04-19
4
Medium Priority
?
2,216 Views
Last Modified: 2012-05-11
I have a file called WPAD.DAT in the root web of a IIS6 server in the US.  All sites everywhere are fine with this file around the world except Tokyo.  I have a line in there that defines to "go direct" if they are within a subnet of 192.168.0.0 - which they are.  But it will not work.  Other sites that are in a 192.168.0.0 subnet work fine.  

If I hard code the Proxy in Internet Explorer, all is OK until they take the laptop home which is why I want to use "automatically detect".  

Please help me.  I wish there was a way to debug the PAC file to see where along this file they drop, or if it is pulled in at all.  I am using HTTPWatch basic and WireShark, but do not see anything jumping out at me.  

I also forced the script to point to the PAC file at the IIS server, no joy.  So it is set back to automatic and I am hoping to fix this ASAP.

FYI - I do have a DNS entry tor WPAD, etc so all that is right....

Here is my PAC file

function FindProxyForURL(url,host)
{
var resolved_ip = dnsResolve(host);
var proxy_str = "PROXY 192.168.237.10:8080; DIRECT";

if (
    isInNet(myIpAddress(), "172.35.0.0", "255.255.0.0") ||
      isInNet(myIpAddress(), "172.21.0.0", "255.255.0.0") ||
    isInNet(myIpAddress(), "172.22.0.0", "255.255.0.0")      ||
      isInNet(myIpAddress(), "192.168.25.0", "255.255.255.0")
  ) {
    proxy_str = "PROXY 192.168.178.10:8080; DIRECT";
  }

if (shExpMatch(url,"*ir.mydomain.com*")) return proxy_str;
if (shExpMatch(url,"*images.mydomain.com*")) return proxy_str;
if (dnsDomainIs(host,".mydomain.com")) return "DIRECT";
if (isPlainHostName(host)) return "DIRECT";
if (isInNet(resolved_ip, "10.0.0.0", "255.0.0.0")) return "DIRECT";
if (isInNet(resolved_ip, "172.16.0.0", "255.240.0.0")) return "DIRECT";
if (isInNet(resolved_ip, "192.168.0.0", "255.255.0.0")) return "DIRECT";
if (isInNet(myIpAddress(), "192.168.201.0", "255.255.255.0")) return "DIRECT";
if (isInNet(myIpAddress(), "192.168.177.0", "255.255.255.0")) return "DIRECT";
return proxy_str;
}
0
Comment
Question by:stowyo
  • 4
4 Comments
 
LVL 1

Author Comment

by:stowyo
ID: 35426624
the site is 192.168.63.0 that is the problem.  
0
 
LVL 1

Author Comment

by:stowyo
ID: 35433537
I got the Site to work fine, but now that site - that is 192.168.63.0 cannot open any Intranet sites.  here is the latest WPAD.DAT file.  BTW, we use DNS to deploy this...

function FindProxyForURL(url,host)
{
var resolved_ip = dnsResolve(host);
var proxy_str = "PROXY 192.168.237.10:8080; DIRECT";
if (isInNet(myIpAddress(), "192.168.63.0", "255.255.255.0")) return "PROXY 192.168.237.10:8080";
if (
    isInNet(myIpAddress(), "172.35.0.0", "255.255.0.0") ||
      isInNet(myIpAddress(), "172.21.0.0", "255.255.0.0") ||
    isInNet(myIpAddress(), "172.22.0.0", "255.255.0.0")      ||
      isInNet(myIpAddress(), "192.168.25.0", "255.255.255.0")
  ) {
    proxy_str = "PROXY 192.168.178.10:8080; DIRECT";
  }

if (shExpMatch(url,"*ir.mydomain.com*")) return proxy_str;
if (shExpMatch(url,"*images.mydomain.com*")) return proxy_str;
if (dnsDomainIs(host,".mydomain.com")) return "DIRECT";
if (isPlainHostName(host)) return "DIRECT";
if (isInNet(resolved_ip, "10.0.0.0", "255.0.0.0")) return "DIRECT";
if (isInNet(resolved_ip, "172.16.0.0", "255.240.0.0")) return "DIRECT";
if (isInNet(resolved_ip, "192.168.0.0", "255.255.0.0")) return "DIRECT";
if (isInNet(myIpAddress(), "192.168.201.0", "255.255.255.0")) return "DIRECT";
if (isInNet(myIpAddress(), "192.168.177.0", "255.255.255.0")) return "DIRECT";


return proxy_str;
}
0
 
LVL 1

Accepted Solution

by:
stowyo earned 0 total points
ID: 35460672
Nobody offered any assistance so here is the correct syntax of this file.  Also, I had to go through the file and ensure there were no tabs, that they were all spaces.  This file is javascript so should be clear text.

The challenge was this.
I wanted To ensure subnet 192.168.63.0 was forced to go out a specific proxy for owa.mycompany.com but DIRECT for the Intranet sites  
I wanted to force some subnets out one proxy (another country)
and the rest through our main proxy in the US
-----------------------------------------------------------------------------------------------------
function FindProxyForURL(url, host)
{
    var resolved_ip = dnsResolve(host);

    if (isInNet(myIpAddress(), "192.168.63.0", "255.255.255.0"))
    {
        if (dnsDomainIs(host,"owa.mydomain.com"))
            return "PROXY 192.168.237.10:8080";
        else
            return "DIRECT";
    }
    else
    {
        if (dnsDomainIs(host,".mydomain.com") ||
            isPlainHostName(host) ||
            isInNet(resolved_ip, "10.0.0.0", "255.0.0.0") ||
            isInNet(resolved_ip, "172.16.0.0", "255.240.0.0") ||
            isInNet(resolved_ip, "192.168.0.0", "255.255.0.0") ||
            isInNet(myIpAddress(), "192.168.201.0", "255.255.255.0") ||
            isInNet(myIpAddress(), "192.168.177.0", "255.255.255.0"))
        {
            return "DIRECT";
        }
        else
        {
            if (isInNet(myIpAddress(), "172.35.0.0", "255.255.0.0") ||
                isInNet(myIpAddress(), "172.21.0.0", "255.255.0.0") ||
                isInNet(myIpAddress(), "172.22.0.0", "255.255.0.0") ||
                isInNet(myIpAddress(), "192.168.25.0", "255.255.255.0"))
            {
                return "PROXY 192.168.178.10:8080; DIRECT";
            }
            else
            {
                return "PROXY 192.168.237.10:8080; DIRECT";
            }
        }
    }
}
0
 
LVL 1

Author Closing Comment

by:stowyo
ID: 35460676
nobody answered my Q, but I wanted to post the correct answer for the next admin
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question