Last active
September 13, 2017 13:39
-
-
Save sheng168/6f5e32825f68e1a326eb61ce73df8a47 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function FindProxyForURL(url, host) { | |
// If the hostname matches, send direct. | |
if (dnsDomainIs(host, "intranet.domain.com") || | |
shExpMatch(host, "(*.abcdomain.com|abcdomain.com)")) | |
return "DIRECT"; | |
// If the protocol or URL matches, send direct. | |
if (url.substring(0, 4)=="ftp:" || | |
shExpMatch(url, "http://abcdomain.com/folder/*")) | |
return "DIRECT"; | |
// If the requested website is hosted within the internal network, send direct. | |
if (isPlainHostName(host) || | |
shExpMatch(host, "*.local") || | |
isInNet(dnsResolve(host), "10.0.0.0", "255.0.0.0") || | |
isInNet(dnsResolve(host), "172.16.0.0", "255.240.0.0") || | |
isInNet(dnsResolve(host), "192.168.0.0", "255.255.0.0") || | |
isInNet(dnsResolve(host), "127.0.0.0", "255.255.255.0")) | |
return "DIRECT"; | |
// If the IP address of the local machine is within a defined | |
// subnet, send to a specific proxy. | |
if (isInNet(myIpAddress(), "10.10.5.0", "255.255.255.0")) | |
return "PROXY 1.2.3.4:8080"; | |
// DEFAULT RULE: All other traffic, use below proxies, in fail-over order. | |
return "PROXY 10.0.1.39:8081; PROXY 7.8.9.10:8080; DIRECT"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment