Netscape Proxy AutoConfiguration ================================ Shanker Balan http://shankerbalan.com/ Changelog: * April 4th 2001 - First stab! The following article describes how to use the Netscape Proxy Autoconfiguration (PAC) file "proxy.pac" to auto configure Netscape browser clients. (1) Add the mime type for .pac into /etc/mime.types application/x-ns-proxy-autoconfig .pac (2) Edit /etc/httpd/conf/httpd.conf and add the "Addtype" handler so that Apache knows what to do when a client requests for any files with a ".pac" extension. AddType application/x-ns-proxy-autoconfig .pac (3) Create the file "proxy.pac" in the Apache DocumentRoot directory (usually /var/www/html/proxy.pac) with the following contents: ----------------cut-here----------------- function FindProxyForURL(url, host) { /* No proxy needed for hosts on our localnet (192.168.1.0/24) */ if (isInNet(host, "192.168.1.0", "255.255.255.0")) return "DIRECT"; else /* For all other hosts, use cix.FooBar.com as proxy */ return "PROXY cix.FooBar.com:8888"; } ----------------cut-here----------------- The only options you might to change is the localnet IP and the FQDN and port for your proxy. (4) Open Netscape and click Edit -> Preferences -> Advanced -> Proxies and set the Configuration location (URL) to http://monster.FooBar.com/proxy.pac Do the same on all clients that you want auto-configured. If you ever need to change any proxy related settings, just make the change in proxy.pac file. Individual configuration of every client on your network is no longer necessary. The above setup describes a very minimalistic use of PAC. You can do more things like: - Load balancing based on URL patterns - Setting a proxy for a specific protocol - Proxy settings based on date and time ranges See the "Navigator Proxy Auto-Config File Format" for more details Please note that the Netscape proxy.pac will _not_ work with other browser clients like Internet Explorer and Opera. Links: Using the Client Autoconfiguration File: http://developer.netscape.com/docs/manuals/proxy/adminux/autoconf.htm Navigator Proxy Auto-Config File Format: http://home.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html