Skip to content

fix: handle bare IPv6 addresses in proxy protocol header#673

Merged
robinbraemer merged 1 commit intomasterfrom
fix/670-ipv6-proxy-protocol-panic
Mar 10, 2026
Merged

fix: handle bare IPv6 addresses in proxy protocol header#673
robinbraemer merged 1 commit intomasterfrom
fix/670-ipv6-proxy-protocol-panic

Conversation

@robinbraemer
Copy link
Member

Summary

  • Fixes runtime error in Lite mode with ProxyProtocol enabled (IPv6 parsing failure) #670 — runtime panic when a client connects via IPv6 in Lite mode with proxyProtocol: true
  • net.SplitHostPort returns "too many colons in address" for bare IPv6 strings like 2a09:bac6:d73f:28::4:31d (no brackets, no port). This was unhandled in netutil.splitHostPort, causing it to return an empty host, which then panicked in protoutil.convert
  • Fix: treat "too many colons in address" the same as "missing port in address" — use the full string as the host with port 0

Test plan

  • Added TestHostPort_BareIPv6 in netutil verifying bare IPv6 addresses parse correctly
  • Added bare IPv6 test cases in TestProxyHeader using connect.Addr with real IPv6 addresses from the issue
  • All existing tests continue to pass

When a client connects via IPv6 through Connect, the address string
(e.g. "2a09:bac6:d73f:28::4:31d") has no brackets or port.
net.SplitHostPort returns "too many colons in address" for this format,
which was unhandled, causing splitHostPort to return an empty host and
triggering a panic in protoutil.convert.
@cloudflare-workers-and-pages
Copy link

Deploying gate-minekube with  Cloudflare Pages  Cloudflare Pages

Latest commit: 36f979d
Status: ✅  Deploy successful!
Preview URL: https://a292d418.gate-minekube.pages.dev
Branch Preview URL: https://fix-670-ipv6-proxy-protocol.gate-minekube.pages.dev

View logs

@robinbraemer robinbraemer merged commit 3db7f7b into master Mar 10, 2026
13 checks passed
@robinbraemer robinbraemer deleted the fix/670-ipv6-proxy-protocol-panic branch March 10, 2026 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

runtime error in Lite mode with ProxyProtocol enabled (IPv6 parsing failure)

1 participant