Skip to content

PROXY protocol sets TCP4/TCP6 protocol based on actual connection, not --haproxy-clientip #21340

@airtower-luna

Description

@airtower-luna

I did this

I used the HAProxy protocol over IPv6, reporting an IPv4 client IP:

curl --ipv6 --haproxy-protocol --haproxy-clientip 192.0.2.42 -v --insecure --connect-to ::localhost:8080 https://example.com/

Resulting proxy protocol header:

PROXY TCP6 192.0.2.42 ::1 50882 8080

Same the other way around, reporting an IPv6 client IP over IPv4:

curl --ipv4 --haproxy-protocol --haproxy-clientip 2001:db8::42 -v --insecure --connect-to ::localhost:8080 https://example.com/

Resulting proxy protocol header:

PROXY TCP4 2001:db8::42 127.0.0.1 44410 8080

I expected the following

The transport protocol reported in the PROXY header must match the client IP (TCP6 if it is IPv6, TCP4 if IPv4). Both HAProxy and Traefik (correctly) reject the connection if there's a mismatch. If I force the transport protocol to match the reported client IP it works (e.g. --ipv6 --haproxy-protocol --haproxy-clientip 2001:db8::42), but the whole point of using the PROXY protocol is to report the actual client IP regardless of proxy transport.

curl/libcurl version

curl 8.20.0-rc2 (x86_64-pc-linux-gnu) libcurl/8.20.0-rc2 OpenSSL/3.6.2 zlib/1.3.2 brotli/1.2.0 zstd/1.5.7 libidn2/2.3.8 libpsl/0.21.5 libssh2/1.11.1 nghttp2/1.68.1 ngtcp2/1.21.0 nghttp3/1.15.0 mit-krb5/1.22.1 OpenLDAP/2.6.10
Release-Date: 2026-04-13, security patched: 8.20.0~rc2-1
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt mqtts pop3 pop3s rtsp scp sftp smtp smtps telnet tftp ws wss
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTP3 HTTPS-proxy IDN IPv6 Kerberos Largefile libz PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd

operating system

Linux haruka 6.19.11+deb14-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.19.11-1 (2026-04-05) x86_64 GNU/Linux (AKA Debian Sid)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions