cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
952
Views
0
Helpful
2
Replies
Mohsin Yasin
Beginner

Ironport WSA Proxy Load Blancing using PAC file

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;"
}
}

2 REPLIES 2

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()

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.