fix(haproxy): set X-CLIENT-IP instead of adding it

add-header let a client-supplied X-CLIENT-IP survive next to ours, so a
backend reading the first occurrence got the attacker's value. set-header
replaces any inbound copy. Refs #10.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-18 16:19:23 -07:00
co-authored by Claude Sonnet 5
parent edddb7a9aa
commit b025dec55e
4 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ backend {{ name }}-backend
option httpchk
# Pass the real client IP to backend (from proxy headers or direct connection)
# This is crucial for container-level logging and security tools
http-request add-header X-CLIENT-IP %[var(txn.real_ip)]
http-request set-header X-CLIENT-IP %[var(txn.real_ip)]
http-request set-header X-Real-IP %[var(txn.real_ip)]
http-request set-header X-Forwarded-For %[var(txn.real_ip)]
{% if ssl_enabled %}http-request set-header X-Forwarded-Proto https if { ssl_fc }{% endif %}