PAC file example
From Tech-Wiki
Revision as of 20:52, 2 May 2018 by Fabricio.Lima (Talk | contribs) (Created page with "Category:Microsoft '''Back to Active Directory''' PAC file to use as proxy selector. <nowiki> function FindProxyForURL(url, host) { var...")
PAC file to use as proxy selector.
function FindProxyForURL(url, host) { var privateIP = /^(0|10|127|192\.168|172\.1[6789]|172\.2[0-9]|172\.3[01]|169\.254|192\.88\.99)\.[0-9.]+$/; var resolved_ip = dnsResolve(host); /* Don't send non-FQDN or private IP auths to us */ // note this will defeat host file entries for external systems if (isPlainHostName(host) || privateIP.test(host)) { return "DIRECT"; } if (dnsDomainIs(host, "www.acme.com") || dnsDomainIs(host, "webmail.acme.com")) { return "PROXY proxy.acme.com:3128; DIRECT"; } /*If the host is an internal IP range, send direct */ 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"; } if (shExpMatch(host, "*.microsoft.com") || shExpMatch(host, "*windowsupdate*")) { return "PROXY proxy.acme.com:3128; DIRECT"; } /* FTP goes directly */ if (url.substring(0,4) == "ftp:") { return "DIRECT"; } // Domains to bypass if ((host == "webmail.acme.com") || (host == "www.acme.com") || (dnsDomainIs(host, "sso.acme.com"))) return "DIRECT"; /* Default Traffic Forwarding */ return "PROXY 165.225.98.34:80; PROXY 175.45.116.34:80; DIRECT"; }