+ Post New Thread
Results 1 to 4 of 4
Windows Thread, PAC File Configuration in Technical; Good morning Gents/Ladies i have been given the task from my company to create a PAC file for our corporate ...
  1. #1

    Join Date
    May 2012
    Posts
    2
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    PAC File Configuration

    Good morning Gents/Ladies i have been given the task from my company to create a PAC file for our corporate laptop users.

    All i need the PAC file to do is to detect that if the user is at work their web traffic will get pointed to our internal proxy if at home to go DIRECT.

    This is what i have.

    function FindProxyForURL (url, host)
    {
    return "PROXY 192.168.10.65:8080; DIRECT";
    }

    My biggest gripe is that if the user is at home it takes upwards of 40 seconds for the PAC file to timeout from not detecting the internal web proxy.


    Can anyone please give me a fix it would be greatly appreciated

    Thanks, Mark

  2. #2

    nickbro's Avatar
    Join Date
    Jul 2010
    Location
    Gilwern, Wales
    Posts
    3,690
    Thank Post
    43
    Thanked 560 Times in 468 Posts
    Rep Power
    124
    If they restart the browser, it should find that it can't connect to the pac file to download it and will go direct.

    Here's my PAC file

    Code:
    function FindProxyForURL(url, host) {
    
        if (shExpMatch(url, "ftp:*")) return "DIRECT";
    
    // If IP address is internal or hostname resolves to internal IP, send direct.
    
        var resolved_ip = dnsResolve(host);
    
        if (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(resolved_ip, "127.0.0.0", "255.255.255.0"))
            return "DIRECT";
        
        return "PROXY rmsmartcache.local:8080; PROXY adsl.local:3128; DIRECT";
     
    }
    We also advertise the pac file via DHCP, do the laptops staff bring in don't need to configure there laptop if they have auto detect ticked

  3. #3

    Join Date
    May 2012
    Posts
    2
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Quote Originally Posted by nickbro View Post
    If they restart the browser, it should find that it can't connect to the pac file to download it and will go direct.

    Here's my PAC file

    Code:
    function FindProxyForURL(url, host) {
    
        if (shExpMatch(url, "ftp:*")) return "DIRECT";
    
    // If IP address is internal or hostname resolves to internal IP, send direct.
    
        var resolved_ip = dnsResolve(host);
    
        if (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(resolved_ip, "127.0.0.0", "255.255.255.0"))
            return "DIRECT";
        
        return "PROXY rmsmartcache.local:8080; PROXY adsl.local:3128; DIRECT";
     
    }
    We also advertise the pac file via DHCP, do the laptops staff bring in don't need to configure there laptop if they have auto detect ticked
    Thank you for your quick reply!!

    With response to your reply our Network Ip ranges are all class c so conflict does happen if the user's router/modem at home also users the same class c range.

    I was thinking about using

    if (isInNet(myIpAddress, "192.168.subnet.0", "255.255.255.0")) ||
    (isInNet(myIpAddress, "192.168.anothersubnet.0", "255.255.255.0")) ||

    etc...

    The only problem is that we have about 20 subnets, curious to whether it may lag checking all the ranges.

    Will let you know

  4. #4

    nickbro's Avatar
    Join Date
    Jul 2010
    Location
    Gilwern, Wales
    Posts
    3,690
    Thank Post
    43
    Thanked 560 Times in 468 Posts
    Rep Power
    124
    No lag at all, the checks on all of the internal ranges, which are communally internal networks which don't need/want to go via a proxy server.

    If your using something like http://wpad.local/wpad.pac as the config address, when the PC is at home, when the browser first starts up and doesn't find the PAC file, it should default back to "DIRECT", that's a one time hit and it's usually very quick. If you do the 252 DHCP option, as long as the user closes the browser when changing location, IE, and Firefox, will pick up on the network change and go direct instead of loading the PAC file



SHARE:
+ Post New Thread

Similar Threads

  1. .pac file problem
    By mrbios in forum Scripts
    Replies: 3
    Last Post: 16th October 2009, 12:28 PM
  2. proxy .pac file
    By sted in forum Windows
    Replies: 12
    Last Post: 24th September 2009, 08:50 PM
  3. .pac files
    By jamiet147 in forum Coding
    Replies: 3
    Last Post: 26th November 2008, 09:51 AM
  4. Replies: 2
    Last Post: 29th April 2008, 04:17 PM
  5. Creating a PAC file
    By u8dmtm in forum Coding
    Replies: 4
    Last Post: 2nd March 2006, 04:49 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •