PAC file is large
low
Above roughly 50 KB a PAC starts to cost measurable time per connection; above 1 MB engines refuse to load it. Long host lists usually belong on the proxy, not in the file every client downloads and executes.
Why it matters
The PAC is downloaded by every client and run for every connection. Thousands of
if (shExpMatch(...)) lines are evaluated sequentially until one matches; for default-route
traffic that is all of them. Very large files also hit hard limits: Chromium rejects PAC
scripts above 1 MiB, and in the lab Windows (WinHTTP) loaded a 1,048,576-byte file but failed
on one byte more (2026-10-11). Hostname allow-lists with hundreds of entries are a sign that proxy
policy (categories, bypass lists) is being maintained in the PAC. Serving the file compressed
(PAC-D006) to the clients that ask for it shortens the download as a stop-gap, but not the
evaluation. Do not force compression on every client: a PAC file that the server always sent
gzip-compressed failed to load on Windows (lab, 2026-10-11). Move policy to the proxy as the fix.
How to fix
Move long bypass lists to the proxy; group remaining rules by domain suffix; let the PAC server compress the file only for clients that send Accept-Encoding gzip.
Examples
Bad
// imagine 3000 lines of the following
function FindProxyForURL(url, host) {
if (host == "host0001.corp.example") { return "DIRECT"; }
if (host == "host0002.corp.example") { return "DIRECT"; }
if (host == "host0003.corp.example") { return "DIRECT"; }
return "PROXY proxy.corp.example:8080";
}
Open bad example in checkerGood
function FindProxyForURL(url, host) {
if (dnsDomainIs(host, ".corp.example")) {
return "DIRECT";
}
return "PROXY proxy.corp.example:8080";
}
Open good example in checkerEngine behaviour
| Engine | Behaviour | Source |
|---|---|---|
| chromium | A PAC file larger than 1 MiB is rejected when it is downloaded, and the browser then connects directly (lab, a file of 1,100,000 bytes). | lab, verified 2026-10-04 |
| winhttp | A PAC body of 1,048,576 bytes (1 MiB) loads; one byte more and the download fails, so the file is not used. | lab, verified 2026-10-11 |