PAC file
A PAC file is a small script that tells a browser or system which sites to open through a proxy.
Updated · Prokso editorial team
PAC (proxy auto-config) is a file with a JavaScript function. For each address, it returns how to go: directly or through a specified proxy.
This way you can send only the sites you need through a proxy and open the rest directly. The file is specified in the system or browser settings as "automatic configuration".
A PAC file has no username or password, so with proxies that require a login the browser will ask for credentials separately. Another option is access by IP (whitelist).
A simpler way to split sites is a browser extension with rules. Setup is in the guides section, for example SwitchyOmega.
A minimal PAC file for one site
The file contains one function, FindProxyForURL(url, host), which the browser calls for every address. This example sends example.com and its subdomains through Prokso and everything else directly:
function FindProxyForURL(url, host) { if (host == "example.com" || dnsDomainIs(host, ".example.com")) return "PROXY gw.prokso.com:823"; return "DIRECT"; }
Instead of 823 you can put a port from the 10000-20000 range if the site needs a sticky IP for the whole session.
What the function can return
| Value | Meaning |
|---|---|
DIRECT | connect without a proxy |
PROXY host:port | an HTTP proxy, for example gw.prokso.com:823 |
SOCKS5 host:port | a SOCKS5 proxy, for example gw.prokso.com:824 |
several values separated by ; | the next one is tried if the previous one is unavailable |
Be careful with a direct fallback: with "PROXY gw.prokso.com:823; DIRECT" the browser silently opens the site from your own IP when the proxy does not answer. If the site must always see the proxy address, return only the proxy. The conditions are checked from top to bottom and the first return wins, so put the more specific rules first.
Where to put the file and how to test it
The file is published at an address, for example on your own server, with the type application/x-ns-proxy-autoconfig. On Windows the address goes into Settings, Network and Internet, Proxy, "Use setup script", and on macOS into the "Automatic proxy configuration" field. Chrome shows the active settings at chrome://net-internals/#proxy. After you change the file, the browser may keep using the old version for a while, and restarting the browser applies the new one.
To test it, temporarily add prokso.com to the condition and open the My IP page: it should show the proxy country. Pages outside the rule will still show your own address, and that is correct.
FAQ
Where do I specify a PAC file?
In the system or browser proxy settings, in the automatic configuration field, as the file's address.
Can I pass a username and password through a PAC file?
No, a PAC file contains only rules. The browser will ask for credentials separately, or you can use access by IP.
Residential $1.59, mobile $2.50, datacenter $0.65 per GB
Sign up in a minute, get access right after payment.