wpad - caching proxy part 2

proxy autoconfig is a combination of DHCP optons, and a bit of JS in a wpad.dat file.

under network>hostnames add an entry 'wpad' pointing to your router's lan-ip
then create a /www/wpad.dat file (got mine from here).
and changed the default rule to point to polipo - 10.0.0.1:8123
also changed .local into .lan for lan hosts, and commented some stuff out that didn't seem relevant.
function FindProxyForURL(url, host) {

// If the hostname matches, send direct.
//   if (dnsDomainIs(host, "intranet.domain.com") ||
//        shExpMatch(host, "(*.abcdomain.com|abcdomain.com)"))
//        return "DIRECT";

// If the protocol or URL matches, send direct.
    if (url.substring(0, 4)=="ftp:" ||
        shExpMatch(url, "http://abcdomain.com/folder/*"))
        return "DIRECT";

// If the requested website is hosted within the internal network, send direct.
    if (isPlainHostName(host) ||
        shExpMatch(host, "*.lan") ||
        isInNet(dnsResolve(host), "10.0.0.0", "255.0.0.0") ||
        isInNet(dnsResolve(host), "172.16.0.0",  "255.240.0.0") ||
        isInNet(dnsResolve(host), "192.168.0.0",  "255.255.0.0") ||
        isInNet(dnsResolve(host), "127.0.0.0", "255.255.255.0"))
        return "DIRECT";

// If the IP address of the local machine is within a defined
// subnet, send to a specific proxy.
//    if (isInNet(myIpAddress(), "10.10.5.0", "255.255.255.0"))
//        return "PROXY 1.2.3.4:8080";

// DEFAULT RULE: All other traffic, use below proxies, in fail-over order.
    return "PROXY 10.0.0.1:8123; DIRECT";

}

and that should be it. Eventhough it's not exactly clear when the wpad is fetched.
(IE is using the proxy, chrome isn't, although it is on another client - be patient).
--
pro-tip (and privacy leak)

vi /etc/config/polipo and add under config polipo 'general'
option disableIndexing 'false'
option disableServersList 'false'
this will enable two additional pages under polipo>status so it's a bit easier to check whether the proxy is being used.

! there seems to be a bug/problem with the on-disk cache - looking in to it.

Comments

Popular posts from this blog

Traffic accounting

QoS with SQM (and something about bufferbloat)