04-28-2015 03:17 AM
Hi,
I am trying to use following script to load balance traffic over multiple IronPort WSA boxes but could not get it working.When i test the script the results are ok but when i deploye and test in production users does not get redirected to Ironport WSA proxy device. Any help will be much appreciated.
function FindProxyForURL(url, host) {
if (dnsDomainIs(host, ".ABC.com || XYZ.com") ||
shExpMatch(host, "(*.http://asr.asd*)"))
return "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";
return "randomProxy();"
}
function randomProxy()
{
switch( Math.floor( Math.random() *2))
{
case 0: return "PROXY 172.17.100.10:80; PROXY 172.17.100.9; PROXY DIRECT;"
case 1: return "PROXY 172.17.100.9:80; PROXY 172.17.100.10; PROXY DIRECT;"
}
}
04-30-2015 01:37 PM
It looks like your missing an else command. Below is how I have it configured and it is working. Without the else command I would think it would just return direct always.
(host == "127.0.0.1") ||
(host == "localhost"))
return "DIRECT"
else
return randomProxy();
}
function randomProxy()
05-04-2015 02:23 AM
I believe that the function randomProxy() is actually never called but the string "randomProxy();" is returned.
Remove the quotation marks and see if that helps.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide