To test a PAC (proxy auto-config) file without touching your browser settings, run its FindProxyForURL(url, host) function yourself in a sandbox that provides the same helper functions a browser does (dnsResolve, isInNet, shExpMatch, myIpAddress and the rest), pass it the URLs you care about, and read the string it returns. Then check that every proxy in that string actually answers. pac-test.mjs does all of that in Node with no dependencies. It also lets you pretend to be on another network (--my-ip), fake DNS answers (--resolve) and change the clock (--at), so you can see what an office laptop, a home laptop and a night-time request each get, and it flags results browsers will reject, such as a password inside the PAC result. Proxy302 maintains this tool and sells proxies: a static residential (ISP) IP costs $7.99 for 30 days, or $0.50 for a one-day test (prices). The tester works with any PAC file and any provider.
Maintained by Proxy302. MIT licensed.
git clone https://github.com/proxy302/pac-file-tester
cd pac-file-tester
node pac-test.mjs example.pac https://www.example.com/
node pac-test.mjs http://wpad.corp.example/proxy.pac https://www.example.com/ http://intranet/ --check
node pac-test.mjs proxy.pac https://shop.example/ --my-ip 10.20.3.7 --resolve shop.example=203.0.113.10
Node 18 or later (it uses the built-in fetch). Options:
| Option | What it does |
|---|---|
--check |
Opens a TCP connection to every proxy in the result and says whether it answered |
--my-ip IP |
The value myIpAddress() returns. Default: the address your computer would use to reach the internet (found the way Chromium does it, with a UDP socket that sends nothing) |
--resolve HOST=IP |
Answer dnsResolve(HOST) with IP instead of asking DNS. Repeat for several hosts |
--at 2026-11-23T09:30 |
Local date and time for weekdayRange, dateRange and timeRange |
--full-url |
Pass https:// URLs with their path and query. By default they are removed, because browsers remove them before calling the PAC function |
The exit code is 0 when every URL produced a usable result, 1 when any URL had an error or a result browsers would reject, 2 when the PAC file could not be loaded and 3 for a syntax error.
Recorded on 23 November 2026 on a Mac. example.pac is served from a local web server on port 28000, a test proxy listens on 127.0.0.1:23128, and nothing listens on 127.0.0.1:23999. The host names are documentation names, answered with --resolve so no real DNS is involved. Real output, nothing edited.
An office laptop (address in 10.20.0.0/16):
$ node pac-test.mjs http://127.0.0.1:28000/example.pac http://intranet/ "https://seller.shop.example/orders?id=42" https://nas.home.example/ https://news.example.org/ --my-ip 10.20.3.7 --resolve seller.shop.example=203.0.113.10 --resolve nas.home.example=192.168.1.20 --resolve news.example.org=198.51.100.7 --check
PAC http://127.0.0.1:28000/example.pac (860 bytes, HTTP 200, Content-Type: application/octet-stream)
myIpAddress 10.20.3.7 (set with --my-ip)
note PAC files are conventionally served as application/x-ns-proxy-autoconfig
http://intranet/
FindProxyForURL("http://intranet/", "intranet")
returns "DIRECT"
1. DIRECT
https://seller.shop.example/orders?id=42
url passed https://seller.shop.example/ (path and query removed, as browsers do for https:// URLs)
FindProxyForURL("https://seller.shop.example/", "seller.shop.example")
returns "PROXY 127.0.0.1:23128"
1. PROXY 127.0.0.1:23128 reachable (TCP 0 ms)
DNS lookups seller.shop.example -> 203.0.113.10 (--resolve)
https://nas.home.example/
FindProxyForURL("https://nas.home.example/", "nas.home.example")
returns "DIRECT"
1. DIRECT
DNS lookups nas.home.example -> 192.168.1.20 (--resolve)
https://news.example.org/
FindProxyForURL("https://news.example.org/", "news.example.org")
returns "PROXY 127.0.0.1:23999; DIRECT"
1. PROXY 127.0.0.1:23999 connection refused
2. DIRECT
DNS lookups news.example.org -> 198.51.100.7 (--resolve)
(exit code 0)
The last URL shows a quiet failure: the office gateway named in the PAC file is down, so every request from the office tries it first and then goes direct. Nothing in the browser tells you that; --check does.
The same PAC on a home network:
$ node pac-test.mjs example.pac https://news.example.org/ --my-ip 192.168.1.5 --resolve news.example.org=198.51.100.7
PAC example.pac (860 bytes, local file)
myIpAddress 192.168.1.5 (set with --my-ip)
https://news.example.org/
FindProxyForURL("https://news.example.org/", "news.example.org")
returns "DIRECT"
1. DIRECT
DNS lookups news.example.org -> 198.51.100.7 (--resolve)
(exit code 0)
Two common mistakes (mistakes.pac):
$ node pac-test.mjs mistakes.pac https://shop.example/ https://example.net/ --my-ip 10.20.3.7
PAC mistakes.pac (222 bytes, local file)
myIpAddress 10.20.3.7 (set with --my-ip)
https://shop.example/
FindProxyForURL("https://shop.example/", "shop.example")
returns "PROXY USER:PASS@127.0.0.1:23128"
1. PROXY USER:PASS@127.0.0.1:23128 <- browsers do not accept a username or password in a PAC result
https://example.net/
FindProxyForURL("https://example.net/", "example.net")
returns "SOCKS5 127.0.0.1; DIRECT"
1. SOCKS5 127.0.0.1 <- no port: write host:port explicitly
2. DIRECT
(exit code 1)
https://host/ to FindProxyForURL (see MDN’s PAC file reference; Firefox has the network.proxy.autoconfig_url.include_path preference). A rule such as shExpMatch(url, "*/admin/*") never matches an https page. Match on host instead.dnsResolve(host) or isInNet(host, ...) near the top of the file makes the browser resolve every host name before it can even pick a proxy. The “DNS lookups” line shows each one. Check dnsDomainIs and shExpMatch rules first and resolve only when you must.TYPE host:port. The browser asks for the proxy’s username and password separately. Chromium-based browsers cannot send a username and password to a SOCKS5 proxy at all, so for a password-protected proxy in Chrome or Edge, return PROXY host:port for an HTTP proxy.PROXY a:1; DIRECT quietly goes direct when a is down. If traffic must never go direct, leave DIRECT out and let the request fail.isPlainHostName, dnsDomainIs, localHostOrDomainIs, isResolvable, isInNet, dnsResolve, convert_addr, myIpAddress, dnsDomainLevels, shExpMatch, weekdayRange, dateRange, timeRange, alert (printed under the URL), and the IPv6 extensions isResolvableEx, dnsResolveEx, myIpAddressEx, isInNetEx, sortIpAddressList, getClientVersion. When a file defines FindProxyForURLEx, it is called instead of FindProxyForURL.
dnsResolve is synchronous inside a PAC file. The tester runs the function, collects the names it asked for, resolves them, and runs it again until every lookup has an answer, so the final result uses real DNS (or your --resolve answers). Each run is stopped after 2 seconds, which catches endless loops.
HTTPS or SOCKS4).--check only opens a TCP connection. To see whether the proxy logs you in and reaches a site, use proxy-error-diagnose.Checked 23 November 2026.