Wpad file for Multiple Networks




WPAD.DAT

Many of us use proxy configuration file to automate proxy configuration for users.

It is easy to configure wpad.dat for single network, but for some reason if you wish to use same wpad.dat file for multiple networks following might help you.

function FindProxyForURL(url, host)
{

if (shExpMatch(url, "http://localhost*")) { return "DIRECT"; }
if (shExpMatch(url, "https://127.0.0.1*")) { return "DIRECT"; }
if (shExpMatch(url, "https://192.168.2*")) { return "DIRECT"; }
//this is for networks
if (isInNet(myIpAddress(), "192.168.10.0", "255.255.255.0"))
return "PROXY 192.168.10.20:3128";
else
return "PROXY 192.168.2.20:3128";
}


if you find any missing point in here, please let us know in comment section or tweet us at @linuxreaders. To get more articles like this, subscribe to our RSS feeds / Mails.
Read 240 articles by

Trending Posts