Networking HowTos
Networking HowTos

What is a .pac proxy auto config file

July 1, 2014 Other

A .pac (Proxy Auto Config) file is a file stored on a web server that contains instructions for the browser, to help automate the proxy server setting configuration in a web browser.
The .pac proxy configuration file contains JavaScript code, and must contain one function called FindProxyForURL. This function accepts two parameters, a URL, and a Hostname.
This function returns either “DIRECT” to tell the client to connect to the web server without using a proxy, or “PROXY” followed by the proxy server address, to tell the client to use the specified proxy server. Combinations can be used, separated by a semicolon, to specify fallback options.
The most simple example of a .pac file would be:

function FindProxyForURL(url, host)
{
	return "PROXY 192.168.123.1:3128; DIRECT";
}

This would tell the browser to use the proxy server on 192.168.123.1, port 3128, and fall back to direct access if the proxy server wasn’t accessible.
For an advanced example of a .PAC file, please check out:
Advanced .PAC proxy auto config file example

You Might Also Like