Use a proxy.pac for automatic proxy configuration. Here is my file.
function FindProxyForURL(url, host) {
if(isInNet(host, "192.168.*.*", "255.255.0.0")) {
return "DIRECT";
} else if (host == "localhost") {
return "DIRECT";
} else {
return "PROXY localhost:9000";
}
}
if(isInNet(host, "192.168.*.*", "255.255.0.0")) {
return "DIRECT";
} else if (host == "localhost") {
return "DIRECT";
} else {
return "PROXY localhost:9000";
}
}
This does following :
a. For all requests to ip address 192.168.*.* do not use a proxy and return DIRECT connection
b. For all requests to local webserver do not use proxy and return DIRECT connection
c. For any other requests use proxy server running at localhost:9000
Notes:
* host is NOT the machine requesting a page. Host is the name/ip of remote server
* url is the full url
* alert statement can be used to debug this function. This behaves just like a normal JS function
0 comments:
Post a Comment