+ Post New Thread
Results 1 to 4 of 4
Internet Related/Filtering/Firewall Thread, PAC file help in Technical; ...
  1. #1

    CHR1S's Avatar
    Join Date
    Feb 2006
    Location
    Birmingham
    Posts
    4,530
    Thank Post
    1,622
    Thanked 500 Times in 307 Posts
    Rep Power
    220

    PAC file help

    I have never written a PAC file to any degree of complexity, I have to set one up for our iPads and am getting stuck.

    So far I have -

    Code:
    function FindProxyForURL(url, host)
    
    {
    if (isInNet(host, “17.*″, “255.0.0.0″))
    return “DIRECT”; else return “PROXY eduproxy.bgfl.org:80″;
    }
    I need to also add in the following as exceptions as well -
    Code:
    localhost
    10.*
    127.0.0.1
    *.bgfl.org
    *.bgfl.eu
    *.link2ict.org
    *.link2ict.bham.org.uk
    *.myvle.org
    *.misportal.net
    *.pceconsole.bham.org.uk 
    *.pceconsole2.bham.org.uk
    Anyone care to help out? Do I just have multiple If statements or something else?

  2. #2

    sparkeh's Avatar
    Join Date
    May 2007
    Posts
    7,015
    Thank Post
    1,362
    Thanked 1,769 Times in 1,191 Posts
    Blog Entries
    22
    Rep Power
    530
    Hmm you could create one 'if' and put them all in eg ours looks like this:
    Code:
    function FindProxyForURL(url, host){
    if (
    	isInNet(host, "<IP_RANGE>", "<SUBNET_MASK") ||
    	isPlainHostName(host) ||
    	localHostOrDomainIs(host, "127.0.0.1") ||
    	dnsDomainIs(host, "<DOMAIN>") 
        ){
    	return "DIRECT";
         }
    
    
    else
    return "PROXY <PROXY>";
    }

  3. Thanks to sparkeh from:

    CHR1S (8th May 2014)

  4. #3
    AlexB's Avatar
    Join Date
    Jul 2006
    Location
    Warwickshire
    Posts
    398
    Thank Post
    40
    Thanked 45 Times in 40 Posts
    Rep Power
    24
    Just go with or, e.g.

    Code:
    if (isInNet(host, “17.*″, “255.0.0.0″) ||
    shExpMatch(url, "*.bgfl.org") ||
    shExpMatch(url, "*.bgfl.eu") ||
    0
    )
    {
        return “DIRECT”; else return “PROXY eduproxy.bgfl.org:80″;
    }

  5. #4
    AlexB's Avatar
    Join Date
    Jul 2006
    Location
    Warwickshire
    Posts
    398
    Thank Post
    40
    Thanked 45 Times in 40 Posts
    Rep Power
    24
    BTW, for local ip ranges I like to use

    Code:
    isInNet(dnsResolve(host), "10.0.0.0", "255.255.255.0") //change as required
    As this handles hostnames that resolve to local addresses and ip addresses

SHARE:
+ Post New Thread

Similar Threads

  1. [ipad] Help making a .PAC File to include HTTPS Proxy
    By Darylrese in forum Netbooks, PDA and Phones
    Replies: 6
    Last Post: 5th July 2013, 07:45 PM
  2. Replies: 2
    Last Post: 29th April 2008, 03:17 PM
  3. .nrg files HELP!
    By thegrassisgreener in forum Windows
    Replies: 5
    Last Post: 6th September 2007, 06:57 PM
  4. batch file help
    By beeswax in forum Scripts
    Replies: 9
    Last Post: 3rd March 2006, 07:48 PM
  5. Creating a PAC file
    By u8dmtm in forum Coding
    Replies: 4
    Last Post: 2nd March 2006, 03: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
  •