# IPv4 loopback/private ranges handled, IPv6 equivalents not

Source: https://findproxyforurl.net/rules/ipv6-not-handled/ · last updated 2026-10-15

Rule PAC-C012 (`ipv6-not-handled`), severity info, category: Correctness.

The PAC routes 127.0.0.0/8 or RFC 1918 literals DIRECT but has no equivalent for ::1, link-local or unique-local IPv6 addresses. IPv6 literal hosts take the default route, usually the proxy.

## Why it matters

An IPv6 address in the URL reaches the script in a different form in each engine. Chrome, Edge
and Firefox pass it without brackets and in lower case: `http://[FD00::A1]/` arrives as
`fd00::a1`. WinHTTP (Windows services and many programs) and WinINet (desktop programs) pass it
in brackets and with the letters as they were written: `[FD00::A1]`. pacparser passes the host
it is given. A guard that accepts only IPv4 addresses rejects all of these forms, and `isInNet`
cannot handle them, so local IPv6 services are sent to the proxy, where the connection usually
fails. On networks with both IPv4 and IPv6, this shows up as tickets that say "works with the
IP, not with the name" or the reverse. `isInNetEx` exists only in some engines (PAC-K003). The
portable way is a string test on the well-known prefixes, after the host has been put into
lower case and its brackets have been removed.


## How to fix

Lower-case the host and remove its brackets, then add host == "::1" and prefix checks for fe80:, fc and fd next to the IPv4 loopback and private rules, or document that IPv6 addresses are meant to go to the proxy.

## Bad

```js
function FindProxyForURL(url, host) {
  if (/^\d+\.\d+\.\d+\.\d+$/.test(host) && isInNet(host, "127.0.0.0", "255.0.0.0")) {
    return "DIRECT";
  }
  return "PROXY proxy.corp.example:8080";
}
```

## Good

```js
function FindProxyForURL(url, host) {
  // Windows passes [FD00::A1], browsers pass fd00::a1: compare without brackets, in lower case
  var h = host.toLowerCase().replace(/^\[(.*)\]$/, "$1");
  if (h == "::1" || shExpMatch(h, "fe80:*") || shExpMatch(h, "fc*:*") || shExpMatch(h, "fd*:*")) {
    return "DIRECT";
  }
  if (/^\d+\.\d+\.\d+\.\d+$/.test(host) && isInNet(host, "127.0.0.0", "255.0.0.0")) {
    return "DIRECT";
  }
  return "PROXY proxy.corp.example:8080";
}
```

## Engine behaviour

- chromium: An IPv6 address in the URL reaches the script without brackets (http://[fd00::10]:8090/ arrives as host fd00::10). (source: lab, verified 2026-10-15)
- firefox: An IPv6 address in the URL reaches the script without brackets (http://[fd00::10]:8090/ arrives as host fd00::10). (source: lab, verified 2026-10-15)
- pacparser: Passes the host exactly as it is given (pactester -h, or the second argument of find_proxy). When no host is given, pactester and the Python module take it from the URL up to the first colon, so http://[fd00::10]:8090/ gives the host [fd00 and no IPv6 test can match. (source: code, verified 2026-10-15)
- winhttp: An IPv6 address reaches the script in brackets and with its letters as written (http://[fd00::10]:8090/ arrives as host [fd00::10], http://[FD00::A1]:8090/ as [FD00::A1]); the host part of url keeps them too. (source: lab, verified 2026-10-15)
- wininet: Desktop programs that use WinINet pass an IPv6 address in brackets and with its letters as written ([FD00::A1] stays [FD00::A1]), although they lower-case ordinary host names. (source: lab, verified 2026-10-15)
