BUG/MINOR: server: check for either proxy-protocol v1 or v2 to send hedaer
authorWilly Tarreau <w@1wt.eu>
Mon, 3 Mar 2025 02:58:46 +0000 (03:58 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 18 Mar 2025 15:18:29 +0000 (16:18 +0100)
commitae7a9fa3a3b028c1e3ec99dea9d83b8ca5f4e91f
tree30110a7c2fc40f9631d1ea16ce7a9f5c62b675d8
parent70de0e1bb0858e20942323b2fd5907f47e197b50
BUG/MINOR: server: check for either proxy-protocol v1 or v2 to send hedaer

As reported in issue #2882, using "no-send-proxy-v2" on a server line does
not properly disable the use of proxy-protocol if it was enabled in a
default-server directive in combination with other PP options. The reason
for this is that the sending of a proxy header is determined by a test on
srv->pp_opts without any distinction, so disabling PPv2 while leaving other
options results in a PPv1 header to be sent.

Let's fix this by explicitly testing for the presence of either send-proxy
or send-proxy-v2 when deciding to send a proxy header.

This can be backported to all versions. Thanks to Andre Sencioles (@asenci)
for reporting the issue and testing the fix.

(cherry picked from commit 730641f7cad32bfff97875716efe4bd784bb006b)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 7b2212f5547ba4268a0de7657ec0b9ca18d40445)
Signed-off-by: Amaury Denoyelle <adenoyelle@haproxy.com>
include/haproxy/server-t.h
src/backend.c
src/proto_rhttp.c