CHR1S Posted May 8, 2014 Posted May 8, 2014 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?
sparkeh Posted May 8, 2014 Posted May 8, 2014 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 "; } 1
AlexB Posted May 8, 2014 Posted May 8, 2014 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″; }
AlexB Posted May 8, 2014 Posted May 8, 2014 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now