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

@ -16,6 +16,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
@ -55,6 +57,8 @@ backend srv_hostssl_local_443
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()]
server srv-0 test2_processor_docker:8080 check weight 1
backend srv_host2_local_443
balance roundrobin
@ -62,6 +66,8 @@ backend srv_host2_local_443
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()]
server srv-0 test_processor_docker:9000 check weight 1
frontend http_in_80
@ -78,6 +84,8 @@ backend srv_host1_local_80
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()]
server srv-0 test_processor_docker:8080 check weight 1
frontend http_in_90
@ -96,6 +104,8 @@ backend srv_host2_local_90
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()]
server srv-0 test_processor_docker:9000 check weight 1
backend certbot_backend