To get automatic proxy configuration working (at the office where proxy is required), you need a webserver (eg. apache2), a name server (eg. bind9), and a DHCP server (eg. dhcp3).
Apache2 config
* Put javascript into setProxy.pac in you webserver root directory (change it for your domains/proxy)
function FindProxyForURL(url, host)
{
if (isPlainHostName(host) ||
dnsDomainIs(host, ".yourdomain1.ca") ||
dnsDomainIs(host, ".yourdomain2.ca"))
return "DIRECT";
else return "PROXY yourproxy.yourdomain.ca:8080; DIRECT";
}
* Link wpad.dat to it (ln -s setProxy.pac wpad.dat)
* add the following to apache mime.types file (on ubuntu just /etc/mime.types):
application/x-ns-proxy-autoconfig dat
application/x-javascript-config pac
* restart apache (/etc/init.d/apache2 restart)
Bind9 config
* add the following to /var/cache/bind/db.yourdomain.ca
wpad IN CNAME apachehost.yourdomain.ca.
* restart named (don't forget to change serial number) - /etc/init.d/bind9 restart
In other words, "wpad" has to resolve to your apache server... so client can "ping wpad"
DHCP config
* add the following to /etc/dhcp3/dhcpd.conf:
option wpad code 252 = text;
option wpad "http://apachehost.yourdomain.ca/setProxy.pac ";(last space is MANDATORY - IE strips last char)
* restart dhcp
That should do it!
This works with KDE 4 - w/ Google Chrome (set in KDE network settings). And with Firefox 3.0.14 with "Automatic proxy" option selected.
No comments:
Post a Comment