Dev tools
Troubleshooting
Common PAC file bugs and how to fix them.
| Symptom | Cause & Fix |
|---|---|
| myIpAddress() returns 127.0.0.1 | The browser can't determine the machine's external interface IP. This often happens on machines with no active network adapters or unusual routing tables. Some browsers (especially Chrome) always return 127.0.0.1 in certain OS configurations. Workaround: use subnet detection via dnsResolve() on a known internal host instead, or avoid myIpAddress()-based logic in WPAD deployments. |
| HTTPS URL path not available | Chrome, Firefox, and all modern browsers strip the path and query from HTTPS URLs before calling FindProxyForURL. You receive only https://hostname:443. shExpMatch(url, "*/some/path*") will never match for HTTPS. Path-based routing only works for plain HTTP. |
| PAC file changes not picked up | Browsers cache PAC files aggressively — often for the entire browser session. To force a reload: restart the browser completely, or use a short Cache-Control: max-age=300 header on your PAC file server. During development, use pacparser to test outside the browser. |
| isInNet() always returns false | You're passing a hostname to isInNet() that failed DNS resolution — dnsResolve() returned "", and isInNet("", ...) returns false. Always guard: var ip = dnsResolve(host); if (ip && isInNet(ip, ...)). |
| PAC file ignored entirely | Wrong MIME type. The server must respond with Content-Type: application/x-ns-proxy-autoconfig. A text/plain or missing content-type causes many browsers to silently reject the file. |
| alert() breaks PAC in IE/Edge | Internet Explorer and legacy Edge treat alert() as an invalid API in the PAC sandbox — calling it causes the entire PAC function to fail silently and the browser falls through to direct connection. Remove all alert() calls before deploying. |
| dnsDomainIs() misses apex domain | dnsDomainIs("example.com", ".example.com") returns false — the bare apex doesn't match the dotted suffix. Combine with an exact check: host === "example.com" || dnsDomainIs(host, ".example.com"). |
| PAC works in Firefox but not Chrome | Chrome caches PAC results per-hostname for the duration of a network profile change, ignoring path-based differences. Chrome also resolves DNS from the host OS rather than the browser's DNS stack in some configurations. Test with pacparser to isolate PAC logic from browser-specific quirks. |