Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information. add PAC examples
content-filter.pac add PAC examples
hosts-filter.pac add PAC examples

Proxy Auto Configuration (PAC)

A proxy auto-config (PAC) file defines how web browsers and other user agents can automatically choose the appropriate proxy server (access method) for fetching a given URL. To create a valid PAC file you simply need to provide a single JavaScript function: FindProxyForURL(url, host). This function is automatically executed by the browser when requests are dispatched.

The URL of the PAC file is either configured manually or determined automatically by the Web Proxy Auto-discovery Protocol.

Example PAC file

function FindProxyForURL(url, host) {
  // our local URLs from the domains below don't need a proxy:
  if (shExpMatch(host, "*")) {
     return "DIRECT";

  // our local URLs from the domains below don't need a proxy:
  if (shExpMatch(host, "*")) {
     return "HTTPS localhost:44300";

  // URLs within this network are accessed through
  // port 8080 on
  if (isInNet(host, "",  "")) {
     return "PROXY";

  // Use a different proxy for each protocol.
  if (shExpMatch(url, "http:*"))  return "PROXY";
  if (shExpMatch(url, "https:*")) return "PROXY";
  if (shExpMatch(url, "ftp:*"))   return "PROXY";

  // All other requests go through port 8080 of
  // should that fail to respond, go directly to the WWW:
  return "PROXY; DIRECT";

For more examples of what you can do with PAC files, use your favorite search engine, and also checkout the individual .pac files in this directory.

Now that you've created your custom PAC file, how do you deploy it? Turns out, all browsers support the proxy auto-discovery protocol (WPAD), which allows us to either (a) manually specify the file, or (b) auto-configure the settings through DNS or DHCP:

Something went wrong with that request. Please try again.