IPv6 zones in URLs are a mistake
- Infrastructure
- Security
- Programming
- Developer Tools
- Open Source
The post walks through a narrow but nasty edge case in IPv6. Link-local IPv6 addresses live in the `fe80::/10` range and are only valid on a single local network segment, so a machine with multiple interfaces may need a zone identifier like `%eth0` to say which link to use. That already makes the address host-specific. The trouble starts when you try to embed it in a URL. `%` is also the escape character for percent-encoding, so syntax like `http://[fe80::4%eth0]:80` collides with URL rules. Older guidance in RFC 6874 said to encode the percent sign as `%25`, but that guidance was later withdrawn by RFC 9844 after browsers found it impractical. The result is exactly what the post complains about. Some tools accept `%25`, some accept raw `%`, some accept both, and browsers mostly do not support the case in a usable way at all.
If your product surfaces raw link-local IPv6 URLs, expect parser bugs, browser incompatibilities, and security footguns. Prefer hostnames, mDNS, ULAs, or normal global IPv6 addresses, and if you must accept zone IDs, pin one parsing rule and test it across every runtime you ship.
- xeiaso.net
- Discuss on HN