A proxy auto-config (PAC) file is used by web browsers to automatically choose an appropriate route to a proxy server for connection to the Internet. It can also be used to route certain groups of users to a specific proxy server and dictate different actions such as routing or filtering for certain URL’s and/or IP Addresses.

PAC files are primarily used in medium to large enterprise networks that use proxy servers with multiple breakout points to the Internet. The PAC file is used to simplify browser configuration, management and support as each time a user attempts to access the web the browser will automatically fetch the PAC file before attempting to access the Internet. This is useful because if you make a change to your network that impacts your Internet gateway infrastructure you don’t need to individually roll out a change of settings to all your users, instead you update a single file which is generally stored in a central location. By storing the file centrally it also makes management and support significantly easier. However, it should be noted that it can also add a single point of failure if no additional redundancy is introduced.

The PAC file settings can be configured in Internet Explorer by going to: Internet Options > Connections > LAN Settings and ticking Use automatic configuration script.

alt text

The PAC file is essentially a JavaScript file that includes the function “FindProxyForURL” that accepts two arguments “url and host”. This function is called before the browser requests a page and it tells the browser whether it should route to a proxy or attempt to go direct.

An example of a simple PAC file can be seen below:

function FindProxyForURL(url, host) { return "PROXY proxy01.fakecompany.com:8080; DIRECT"; }

In the above example all URL’s will be routed to proxy01.fakecompany.com on port 8080 and if this address is unavailable it will attempt to route direct. However, unless you have specific routing configured on your network for direct access, the request would fail.

For more information on PAC files please refer to the article “Writing Effective Proxy PAC Files”.