Home > Linux, SystemAdmin > Wpad file for Multiple Networks

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)
{
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";
}
  • Stumbleupon
  • Delicious
Google Buzz
Share and Enjoy:
  • Digg
  • Twitter
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Yahoo! Buzz
  • Reddit
  • BlinkList
  • del.icio.us
  • DZone
  • email
  • IndianPad
  • LinkedIn
  • Live
  • Print
  • Technorati
  1. No comments yet.
  1. No trackbacks yet.