Jump to content

Recommended Posts

Posted

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 -

 

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 -

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?

Posted

Hmm you could create one 'if' and put them all in eg ours looks like this:

function FindProxyForURL(url, host){
if (
isInNet(host, "", "	isPlainHostName(host) ||
localHostOrDomainIs(host, "127.0.0.1") ||
dnsDomainIs(host, "") 
   ){
return "DIRECT";
    }


else
return "PROXY ";
}

  • Thanks 1
Posted

Just go with or, e.g.

 

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″;
}

Posted

BTW, for local ip ranges I like to use

 

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...