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:
parent
4aba68dd37
commit
776f216a36
19 changed files with 480 additions and 4 deletions
46
tests_e2e/docker/docker-compose-proxy-headers.yml
Normal file
46
tests_e2e/docker/docker-compose-proxy-headers.yml
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
# ==============================================================================
|
||||
# E2E TEST: Proxy Headers Verification
|
||||
# ==============================================================================
|
||||
#
|
||||
# WHAT THIS DEMONSTRATES:
|
||||
# - All 5 standard proxy headers are set correctly
|
||||
# - X-Forwarded-For: Client IP address
|
||||
# - X-Forwarded-Port: Port HAProxy received request on
|
||||
# - X-Forwarded-Proto: Protocol (http or https)
|
||||
# - X-Forwarded-Host: Original Host header from client
|
||||
# - X-Request-ID: Unique request identifier (UUID)
|
||||
# - HAProxy logs contain unique-id for request correlation
|
||||
#
|
||||
# ==============================================================================
|
||||
|
||||
services:
|
||||
haproxy:
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: build/Dockerfile
|
||||
image: byjg/easy-haproxy:local
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "-u", "admin:password", "http://localhost:1936"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
start_period: 30s
|
||||
retries: 3
|
||||
environment:
|
||||
EASYHAPROXY_DISCOVER: docker
|
||||
HAPROXY_USERNAME: admin
|
||||
HAPROXY_PASSWORD: password
|
||||
HAPROXY_STATS_PORT: 1936
|
||||
ports:
|
||||
- "80:80/tcp"
|
||||
- "443:443/tcp"
|
||||
- "1936:1936/tcp"
|
||||
|
||||
# Header echo server for testing - responds with all received headers
|
||||
webapp:
|
||||
build: ../fixtures/header-echo
|
||||
labels:
|
||||
easyhaproxy.http.host: test.local
|
||||
easyhaproxy.http.port: 80
|
||||
easyhaproxy.http.localport: 8080
|
||||
Loading…
Add table
Add a link
Reference in a new issue