Question:
How to test a PAC file?
Environment: Cisco Web Security appliance (WSA), Explicit mode, PAC file
PAC file errors are usually not displayed by Browsers like Internet Explorer, Firefox etc. These errors can be syntax or logic related.
It is possible to troubleshoot the syntax and logic of a PAC file using a simple Java function: Alerts()
The example below shows how to apply this function to determine whether or not the PAC file was processed and which of my "if" statement was matched:
function FindProxyForURL(url, host)
{
javascript:alert ("Inside the function");
if (isInNet(host, "200.0.0.0", "255.0.0.0"))
{
javascript:alert ("Inside 1st if");
return "PROXY 10.49.217.162:80";
}
if (isInNet(host, "210.0.0.0", "255.0.0.0"))
{
javascript:alert ("Inside 2nd if");
return "PROXY 10.49.217.162:80";
}
else return "DIRECT";
}
Note: This could be useful to troubleshoot more advanced PAC file scripts that are performing load balancing for instance.