Penguin
Note: You are viewing an old revision of this page. View the current version.

Acronym for Web Proxy Autodiscovery Protocol.

WPAD lets web browsers automatically find and use a WebProxy (see our ProxyServerNotes). A reasonable starting point for WPAD is here: http://www.squid-cache.org/Doc/FAQ/FAQ-5.html#ss5.10

WPAD lets you use many methods to automatically specify a proxy server configuration file on the network - DHCP, DNS, or manual specification. The file is a .PAC (Proxy Auto Configuration) file, which is defined in Netscape's definition of PAC files.


The Easy Method

Step 1: if all your clients are something.yourdomain.tla (the connection suffix is assigned with DHCP - if you're unsure, and running Windows, run 'ipconfig' from a command prompt)

Step 2: set your gateway machine up so that it has a CNAME for wpad.yourdomain.tla pointing to server.yourdomain.tla

Step 3: Copy something like this into your HTTP root as wpad.dat

function FindProxyForURL(url, host) {

if(shExpMatch(url, "!https:*") || isPlainHostName(host) || \

dnsDomainIs(host, ".yourdomain.tla") || dnsDomainIs(host, ".youralias.tla"))

{

return "DIRECT";

} else {

return "PROXY www-cache.yourdomain.tla:3128; DIRECT";

}

}

Step 4: Check you can access it by going !http://wpad.yourdomain.tla/wpad.dat.

(Optional) Step 5: Make Apache serve it with the correct MIME type (x-ns-proxy-autoconfig) using a virtual host in your Apache configuration file (/etc/apache/httpd.conf)

<!VirtualHost? ip.ad.dr.es>

ServerName? wpad.yourdomain.tla

AddType? application/x-ns-proxy-autoconfig .dat

</!VirtualHost?>

My MSIE 6.00.2800.1106 on Win98SE does not look up the hostname. So I had to write

<!VirtualHost? ip.ad.dr.ess>

ServerName? ip.ad.dr.ess

AddType? application/x-ns-proxy-autoconfig .dat

</!VirtualHost?>


InternetExplorer has a "Automatically detect settings" check box. This will cause the browser to search for the configuration file.

If your DomainName is machine.something.meta.net.nz then InternetExplorer will request the following urls1? until it finds a WPAD configuration file.

Note: you might need to take the tick out of the check box and put it back in order to make it go.

Warning: Beware that Internet Explorer 5.5+ may cache your wpad file and not recognize future changes you make to it -- this feature is referred to as Automatic Proxy Result Cache (MS Knowledge Base 271361?). If you turn off "Automatically detect settings", save the change, restart IE, turn it back on, and restart IE again, then it will force a refresh of the wpad.dat file from your webserver (If you're lucky. It seems IE 6 refuses to flush even then). Here is a Google Groups' discussion of the issue.

Some versions of IE have a bug and request wpad.da instead of wpad.dat. Copying or linking wpad.dat to wpad.da should work around this. Don't forget to set the appropriate MIME type for this file as well.


Other alternatives include (subst. host.co.nz for your hostname):

The DHCP method (the MicrosoftCorporation "preferred option", which like most MSFT'isms, doesn't actually work). Add the following to your /etc/dhcpd.conf

option option-252 "!http://wpad.host.co.nz/proxy.pac";

With ISC DHCP v3+, 'option-#' options don't work, You have to do this in the global section of your configuration
option wpad-url code 252 = text; (define a new option) option wpad-url "!http://wpad.host.co.nz/proxy.pac"; (use new option)

or if you're configuring a Windows DHCP server, right click on the server and click "Set predefined options" to add 252 as a String value (it's not in there by defult. See here for more.)

The DNS method(s). Add all or some of the follwing entries to your DNS zone file.

$ORIGIN host.co.nz. wpad IN A 192.168.0.254

IN TXT "service: wpad:!http://wpad.host.co.nz:80/proxy.pac"

wpad.tcp IN SRV 0 0 80 wpad.host.co.nz.

See also:


Footnotes

1? I would assume that someone could register wpad.co.nz and be really nasty if they wanted.

wpad.com does actually exist and is owned by Duane Wessles, the author of Web Caching. There's no wpad.dat there. I mailed him a while back asking about it, and he constantly gets between 10 and 40 hits per second depending on the time of day. The 404 logs for that site are at http://www.life-gone-hazy.com/snmp/http_status.cgi if you're interested.


CategorySystemAdministration