Last active
April 5, 2017 09:13
-
-
Save tjgruber/3ed9f6dd598193e01144 to your computer and use it in GitHub Desktop.
Used for deployment of Proxy
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 the domains below, send direct (bypass proxy). | |
if (dnsDomainIs(host, ".your.domain") || | |
dnsDomainIs(host, ".domain1.com") || | |
dnsDomainIs(host, ".domain2.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 192.168.3.210:3128"; | |
// DEFAULT RULE: All other traffic, use below proxies, in fail-over order. | |
return "PROXY serv-proxy1.your.domain:3128; PROXY serv-proxy2.your.domain:3128; DIRECT"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment