The Web Proxy Auto Discovery (WPAD) protocol is a technique for user-agents to find a nearby caching proxy automatically. The idea is relatively simple. The protocol provides a number of methods for generating a URL that refers to a Proxy Auto-Configuration file. Those methods include DHCP, DNS lookups, and SLP (the Service Location Protocol).

DHCP is the first method the user-agent should try. It sends a query for "option 252" to a local DHCP server. The response is a string: the URL. Here's how to configure ISC's DHCP server for WPAD:

option wpad code 252 = text;

option wpad "";

The second method is SLP. However, its implementation is optional. I do not know if any user-agents actually support WPAD via SLP.

DNS is the last resort. The protocol specification outlines a number of DNS techniques a user-agent might use to find a wpad.dat URL. The most straightforward technique is to perform an address lookup for the hostname wpad in the local domain. For example, if the system's hostname is orion.example.com, the agent requests the IP address of wpad.example.com. If the lookup is successful, the agent makes a TCP connect to that address on port 80 and requests /wpad.dat.

To make this work in Apache, you need to set the content type for the wpad.dat file like this:

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

This may have negative side effects if your server has other files that end with .dat. One trick some people use is to redirect requests for wpad.dat to proxy.pac, with commands like this in httpd.conf:

Redirect /wpad.dat http://wpad.example.com/proxy.pac

Note that you probably won't be able to set up a separate virtual host for the wpad name in your domain. This is because some user-agents set the Host header to the IP address, rather than the hostname. The following is an example.

GET /wpad.dat HTTP/1.1

Accept: */*

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Win32)


WPAD is enabled by default in Microsoft Internet Explorer. Konqueror also supports WPAD but disables it by default. You can enable WPAD in Konqueror by visiting the proxy configuration page (described in the Section F.1) and selecting Auto Configure Proxy. Although the current stable versions of Netscape (v7.02) and Mozilla (v5.0) don't implement WPAD, future versions will.

    Appendix A. Config File Reference