1
0
Fork 0

Add support for proxy-awareness headers: X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto, X-Forwarded-Host, and X-Request-ID

- Updated HAProxy configuration template to set all standard proxy headers for HTTP requests.
- Added support for a unique request ID via `unique-id-format` and `unique-id-header` directives.
- Implemented E2E tests for header validation, request correlation, and configuration correctness.
- Enhanced documentation to explain usage and examples of proxy headers.
- Updated CI workflows to include E2E tests for proxy headers.
This commit is contained in:
Joao Gilberto Magalhaes 2026-02-16 17:26:59 -05:00
parent 4aba68dd37
commit 776f216a36
19 changed files with 480 additions and 4 deletions

View file

@ -25,6 +25,8 @@ global
defaults
log global
unique-id-format %{+X}o\ %ci:%cp_%fi:%fp_%Ts_%rt:%pid
unique-id-header X-Edge-Request-ID
option httplog
timeout connect 3s
@ -99,6 +101,8 @@ backend srv_{{ host }}
option forwardfor
http-request set-header X-Forwarded-Port %[dst_port]
http-request add-header X-Forwarded-Proto https if { ssl_fc }
http-request set-header X-Forwarded-Host %[req.hdr(Host)]
http-request set-header X-Request-ID %[uuid()]
{% elif mode == "tcp" %}
option tcp-check
tcp-check connect{{ " ssl" if o["ssl-check"] == "ssl" }}