Showing posts with label proxy. Show all posts
Showing posts with label proxy. Show all posts

Sunday, November 20, 2011

Web browser’s default auto detect proxy server feature chooses proxy server I don’t want to use.

There are a couple reasons you might want to use wpad.dat that I know of.
1) you want to use a proxy server for certain websites, but not for others.
2) you don’t want to use a proxy server, you want to go directly out the internet and bypass, but machines auto detect one.
3) a mixture of the above.
The cure is wpad.dat, if you can control DHCP options, then this is a great choice.  Add the following options to your scope options.
option wpad-url code 252 = text;
option wpad-url “http://webserver.com/wpad.dat”;
The wpad.dat example file below basically says, go directly to a website, unless it is in domainyouwant2useproxy4.com, then use a specified proxy
Contents of wpad.dat file below:

function FindProxyForURL(url, host)
{
   if (isPlainHostName(host))
    return "DIRECT";
   else if (shExpMatch(host, "*.domainyouwant2useproxy4.com"))
    return "PROXY proxy.domain.com:8888";
   else if (shExpMatch(host, "*"))
    return "DIRECT";
}