]> git.kaiwu.me - haproxy.git/commit
MINOR: http/hardening: implement hardening "reject-duplicate-host-header"
authorWilly Tarreau <w@1wt.eu>
Mon, 26 Oct 2026 18:53:06 +0000 (19:53 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 4 Nov 2026 21:45:32 +0000 (22:45 +0100)
commit9d6b4467a574f0fe605f0e8c06704b109f7776e2
tree8cf3388967762786580aab25a3834585f559eeb5
parent5ce1709d2cdbb026946b96d24fafb022e2f47b63
MINOR: http/hardening: implement hardening "reject-duplicate-host-header"

Rejects requests containing more than one "Host" header field, even if
valid and identical. This is recommended on untrusted listeners. Note that
even if not rejected, duplicate host header fields are folded into a
single one. This was done for h1/h2/h3 which all had the explicit
check to perform deduplication.

In h2 and h3 we also had to make sure not to count host+authority as a
duplicate, so that requires a host counter as a local var, but that's
cheap.

Note that h3 currently doesn't check that duplicate headers are strictly
equal, only the first one is kept.
doc/configuration.txt
include/haproxy/http-t.h
src/h1.c
src/h2.c
src/h3.c
src/http.c