Tech Journal Back to Tech Journal

How do I install auto-proxy configuration on my network? i.e. WPAD (Assuming Apache server)

The following has been customized to match the domain, where the name of the proxy server is and the Apache server's IP is

Step 1: Configure DNS

Set DNS for to point to the Apache server using:

wpad  IN  CNAME   spinner


wpad  IN  A

(use the second options if the server doesn't have a name)

Step 2: Create Proxy Auto-Config File

Create a file wpad.dat (and a link from wpad.da [due to a bug in IE]) in the / (root) directory of the server.

The file's format is as follows:

function FindProxyForURL(url, host)
        if(shExpMatch(url, "!https:*")
            || isPlainHostName(host)
            || dnsDomainIs(host, ""))
                return "DIRECT";
        else if (url.substring(0, 4) == "ftp:") {
                return "PROXY; DIRECT";
        else if (url.substring(0, 5) == "http:") {
                return "PROXY; DIRECT";
        } else {
                return "DIRECT";

That will send all HTTP through a web-proxy on port 8080, all FTP through an FTP-proxy on port 8021 (unless the host is in the local network or is contacted through HTTPS.) All other requests will be done directly.

(Note: maybe using an FTP-proxy isn't always a good idea, since IE's proxy support isn't the best in the world.)

Step 3: Add the MIME-type and Hostname to the Apache Server

Add the MIME type for the auto-config, for .DAT files, by editing the Apache config file:

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

Step 4: Add WPAD entry option to DHCP

Add this line to your /etc/dhcpd.conf:

option option-252               "";

That doesn't work with DHCPd version 3+, so instead add this line to the global settings

option wpad-url    code 252 = text;

And this line inside the settings for the subnet being served:

option wpad-url    "\n";
Last updated on 2005-02-17 14:00:00 -0700, by Shalom Craimer

Back to Tech Journal