Return value is not a valid proxy string
high
The function returns something that is not a string of semicolon-separated 'DIRECT' / 'PROXY host:port' / 'SOCKS host:port' entries (or an engine-specific extension). Engines drop what they cannot parse and typically end up DIRECT.
Why it matters
The return grammar is a list of entries separated by ;, each DIRECT, PROXY host:port
or SOCKS host:port. Chromium additionally understands HTTPS, SOCKS4 and SOCKS5
(see PAC-K005, PAC-K006); it does not accept HTTP or QUIC as PAC keywords. A return of
a number, null, an object, an empty string, a non-ASCII string, a keyword without a
space before the host, host: with an empty port, or an unknown keyword is a malformed
directive. Keyword matching itself is case-insensitive in Chromium, but Windows (WinHTTP)
ignores a lower-case proxy or direct, and it reads PROXY a:3128 DIRECT without the ;
as plain DIRECT (lab, 2026-10-11). Entries that fail to parse are skipped; when nothing is
left the client connects directly. This is mechanism (c) of the “silent DIRECT” family:
the PAC appears to work, the proxy is simply not used.
How to fix
Return a string such as "PROXY proxy.corp.example:8080; DIRECT" with upper-case keywords and one space before host:port.
Examples
Bad
function FindProxyForURL(url, host) {
if (isPlainHostName(host)) {
return "direct";
}
return "Proxy:proxy.corp.example:8080";
}
Open bad example in checkerGood
function FindProxyForURL(url, host) {
if (isPlainHostName(host)) {
return "DIRECT";
}
return "PROXY proxy.corp.example:8080";
}
Open good example in checkerEngine behaviour
| Engine | Behaviour | Source |
|---|---|---|
| chromium | Entries that do not parse are skipped; if no valid entry remains the list is treated as DIRECT (ProxyList::SetFromPacString). Accepted keywords (case-insensitive) are PROXY, HTTPS, SOCKS, SOCKS4, SOCKS5, DIRECT. A non-ASCII return string fails the evaluation. | code, verified 2026-10-04 · ref |
| winhttp | Lenient and different from Chromium: "PROXY a:3128 DIRECT" (no ';') and a tab between entries give DIRECT; lower-case "proxy" or "direct" is ignored; a ',' also separates entries; one empty entry ("PROXY ; PROXY b:1") removes the whole list; the keyword HTTP gives no entries; an unknown keyword is skipped; "PROXY DIRECTORY:80" is read as DIRECT; "PROXY http://a:8080" becomes the proxy "http" on port 80; an IPv6 proxy without brackets is cut at the first ':'. undefined, null and a number give no entries. | lab, verified 2026-10-11 |
Related rules
- Proxy port out of range or not numeric PAC-E012
- PROXY entry without a port PAC-X013
- SOCKS keywords mean different versions on different engines PAC-K005
- HTTPS proxy keyword without a PROXY fallback PAC-K006