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:"
||
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"
;
// Round robin based on source ip address, with failover
// Find the 4th octet
var myip=myIpAddress()
var ipbits=myip.split(".")
var myseg=parseInt(ipbits[3])
// Check to see if the 4th octect is even or odd
if (myseg & 1) {
// Odd
return "PROXY 172.18.0.160:9090; PROXY 172.18.0.159:9090; DIRECT";
}
else {
// Even
return "PROXY 172.18.0.159:9090; PROXY 172.18.0.160:9090; DIRECT";
}
}