Frequently asked questions
Quick answers to the questions that come up most often when working with PAC files.
What is a PAC file, in one sentence?
A plain-text JavaScript file with a single FindProxyForURL(url, host) function
that the browser calls for every request to decide whether to go direct or through a proxy.
The full explanation is in What is a PAC file?
What's the difference between a PAC file and WPAD?
A PAC file is the configuration script. WPAD is the mechanism that lets browsers find that script automatically over DHCP or DNS, so you don't have to enter its URL on every machine. See WPAD auto-discovery.
Can a PAC file match on the URL path?
Only for plain http:// URLs. For https://, browsers strip the path
and query before calling the PAC function — you receive only the scheme, host, and port. So
shExpMatch(url, "*/admin/*") never matches an HTTPS request. See
Troubleshooting.
Why does myIpAddress() return 127.0.0.1?
Some browsers and OS configurations can't determine the machine's external interface and
return the loopback address instead. Avoid building routing logic around
myIpAddress() in those environments; resolve a known internal host instead.
Details in Troubleshooting.
How do I make my PAC file fast?
Put DNS-free checks (isPlainHostName, dnsDomainIs,
shExpMatch) first, resolve DNS at most once with dnsResolve() and
reuse the result, and always pass a pre-resolved IP to isInNet(). See
Compute-intensive functions and Best practices.
How should I serve a PAC file?
Over HTTPS, with the MIME type
application/x-ns-proxy-autoconfig. The wrong content type causes many browsers to
silently ignore the file. For WPAD, name it wpad.dat.
My PAC changes aren't taking effect. Why?
Browsers cache PAC files aggressively, often for the whole session. Restart the browser, or
send a short Cache-Control: max-age=300 header during development, and test logic
with pacparser
outside the browser.
How do I test a PAC file without deploying it?
Use the live tester on this site for a quick in-browser check, or
pacparser/pactester on the command line for the real evaluation
engine. See Testing & debugging.
Is the live tester sending my PAC file anywhere?
No. It evaluates everything locally in your browser and transmits nothing. DNS helpers return simulated results. See the Privacy Policy.
Is this an official Mozilla or Google site?
No. PAC Explained is an independent, community-maintained reference. Read more on the about page, and report any error via the contact page.