# Proxy port out of range or not numeric

Source: https://findproxyforurl.net/rules/invalid-proxy-port/ · last updated 2026-10-11

Rule PAC-E012 (`invalid-proxy-port`), severity high, category: Errors and robustness.

A PROXY/SOCKS entry carries a port that is not an integer between 1 and 65535. Browsers discard the entry; when no other entry follows, traffic goes DIRECT.

## Why it matters

`PROXY proxy.corp.example:99999` is a typo that no engine can use as intended. Chromium fails
to parse the host:port pair and drops the entry; if it was the only entry the request is sent
directly. Windows (WinHTTP) keeps the entry but with another port: in the lab (2026-10-11)
99999 became 34463 and -1 became 65535. pacparser returns the string verbatim, so a pactester-based pipeline does not
catch it (lab, 2026-05-20). A port of `0` or a negative or non-numeric value is equally
invalid.


## How to fix

Use the real listening port of the proxy (1-65535) and test the return string in a browser, not only with pacparser.

## Bad

```js
function FindProxyForURL(url, host) {
  return "PROXY proxy.corp.example:99999";
}
```

## Good

```js
function FindProxyForURL(url, host) {
  return "PROXY proxy.corp.example:8080";
}
```

## Engine behaviour

- chromium: host:port that does not canonicalise to a valid port yields an invalid ProxyServer; the entry is dropped and the remaining list (empty = DIRECT) is used. (source: code, verified 2026-10-04)
- pacparser: Returns the malformed string unchanged; no validation. (source: lab, verified 2026-05-20)
- winhttp: The entry is kept with a different port: 99999 became 34463, -1 became 65535, 0 became 80 and "80abc" became 80. (source: lab, verified 2026-10-11)
