Skip to content
Get Started
G2G2
4.7/5
Excellent
Trustpilot

What Is a PAC File (Proxy Auto-Config)?

A PAC file (Proxy Auto-Config) is a small JavaScript file with one function, FindProxyForURL, that a browser or operating system calls for every request to decide whether it goes direct or through a proxy, and through which one. It lets one setting route different sites through different proxies.

  • Session Control
  • High Speed
  • Privacy First
Best fit for PAC fileStatic ISP Proxiesfrom$0.75/IP
how it works

How a PAC file works

You point your browser or OS at a PAC URL (Automatic proxy configuration). For each request it calls FindProxyForURL(url, host) and reads the returned string: DIRECT, PROXY host:port, SOCKS5 host:port, or a semicolon-separated list to try in order. Helper functions such as shExpMatch, dnsDomainIs and isPlainHostName make the rules readable.

Networks can also publish a PAC file for automatic discovery with WPAD, through DHCP or a wpad DNS name. Chrome passes only the scheme and host of https:// URLs to the function, so rules for secure sites should match on the host, not the path.

proxy.pacJavaScript
function FindProxyForURL(url, host) {
  // Local names and the intranet go direct
  if (isPlainHostName(host) || dnsDomainIs(host, ".corp.example")) {
    return "DIRECT";
  }
  // Only these sites use the proxy, falling back to direct
  if (host === "example.com" || dnsDomainIs(host, ".example.com")) {
    return "PROXY HOST:PORT; DIRECT";
  }
  return "DIRECT";
}
why it matters

Why PAC files matter for proxy users

A PAC file is the simplest way to send only some traffic through a proxy without touching each app: a research team can route one set of sites through a US proxy and leave everything else direct.

CleanProxies static ISP proxies support IP authentication for up to 20 IPv4 addresses, so a PAC rule like PROXY HOST:PORT works without a login prompt.

PAC file: what it means for you
  • PAC files cannot hold usernames and passwords. The browser asks for proxy credentials separately, so IP whitelisting is the smoother fit.
  • Serve the file with the application/x-ns-proxy-autoconfig content type; some clients ignore it otherwise.
  • Avoid dnsResolve() and isInNet() on every request: they trigger local DNS lookups for each host and slow browsing down.
  • Add ; DIRECT as a fallback only where leaking traffic outside the proxy is acceptable.

Static ISP proxies from $0.75/IP

The CleanProxies proxy that fits best here, with a $4.99 trial to test it first.

Dedicated IPs on US carrier ASNs with unlimited bandwidth and threads, never shared.

starting from$0.75/IP

Dedicated static IPs registered to US and Canadian ISPs. The address stays the same for as long as you hold it, with unlimited bandwidth and HTTP(S) or SOCKS5 access.

Guides from the blog

Setup guides and best practices from the CleanProxies blog.

Get the latest insightsAll Blogs

Related terms

Terms that come up alongside PAC file.

All glossary terms

PAC file FAQs

Straight answers about PAC file.

Proxy Auto-Config. A PAC file is JavaScript that decides, per URL, which proxy a browser uses.

Got more questions?All FAQs