Wpad file for Multiple Networks

WPAD.DAT

Many of us use this 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)
{%MINIFYHTMLea533966fa2440085d953425e10e33ca11%%MINIFYHTMLea533966fa2440085d953425e10e33ca12%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.

Article by Dhaval Thakar

Hi, I am Linux Admin. You'll find my articles small & without much descriptions.
Read 218 articles by

Archives

Categories

Page optimized by WP Minify WordPress Plugin