0

Below are the configuration of current proxy.pac file.

function FindProxyForURL(url, host)
{
var resolved_ip = dnsResolve(host);
if (isInNet(resolved_ip, "10.0.0.0", "255.0.0.0") ||
isInNet(resolved_ip, "172.16.0.0", "255.240.0.0") ||
isInNet(resolved_ip, "192.168.0.0", "255.255.0.0") ||
isInNet(resolved_ip, "127.0.0.0", "255.0.0.0"))
return "DIRECT";
else
   return "PROXY 172.16.51.254:8080";

We need to change in below line. Please help me on this.

   return "PROXY 172.16.51.254:8080";

We have many offices and which have different proxy so we need to single wpad file for whole network.

We are NOT going to be hard-coding 172.16.51.254 in this file. Instead, we need to have the wpad/pac file figure out what the proxy is. It will know the proxy address by replacing the 4th octet of the person's PC with .254.

Example: If your PC address is 172.16.51.83, then the Proxy will be 172.16.51.254. If your PC address is 172.16.8.22, then the Proxy will be 172.16.8.254.

1 Answer 1

1

Did you ever receive an answer?

Try something like this:

function FindProxyForURL(url, host) {
// Proxy variables
var PROXY1 = "PROXY 172.16.51.254:8080"
var PROXY2 = "PROXY 172.16.8.254:8080"
var BLACKHOLE = "PROXY 127.0.0.1:8080"  //Deny Internet access by using localhost as proxy
var CLIENTIP = myIpAddress();
var resolved_ip = dnsResolve(host);

if (
    isInNet(resolved_ip, "10.0.0.0", "255.0.0.0") || 
    isInNet(resolved_ip, "172.16.0.0", "255.240.0.0") || 
    isInNet(resolved_ip, "192.168.0.0", "255.255.0.0") || 
    isInNet(resolved_ip, "127.0.0.0", "255.0.0.0")
) 
return "DIRECT";

if (
    isInNet(CLIENTIP,"172.16.51.0","255.255.255.0")  //If CLIENTIP falls in range
)
return PROXY1;  //return specific proxy

if (
    isInNet(CLIENTIP,"172.16.8.0","255.255.255.0")//If CLIENTIP falls in range
)
return PROXY2;  //return specific proxy

return BLACKHOLE; //If all of the above fails return blackhole proxy, e.g. deny internet access

}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .