Other configurations
Proxy Headers
EasyHAProxy automatically sets standard proxy-awareness headers for all HTTP requests:
| Header | Description | Example Value |
|---|---|---|
| X-Forwarded-For | Client IP address | 203.0.113.50 |
| X-Forwarded-Port | Port HAProxy received request on | 443 |
| X-Forwarded-Proto | Protocol (http or https) | https |
| X-Forwarded-Host | Original Host header from client | example.com |
| X-Request-ID | Unique request identifier (UUID) | 550e8400-e29b-41d4-a716-446655440000 |
These headers help backend applications:
- Determine the original client IP
- Detect HTTPS vs HTTP
- Generate correct URLs with proper hostname
- Correlate requests for debugging and monitoring
Note: Headers are only added in HTTP mode, not TCP mode.
Before the First Service
While no container, service or Ingress is configured, EasyHAProxy answers every request on port 80 with a page
that explains how to add the first one and links to this documentation. The page does not show the EasyHAProxy
version. It goes away as soon as a service is configured.
Exposing Ports
Some ports on the EasyHAProxy container and in the firewall are required to be open. However, you don't need to expose the other container ports because EasyHAProxy will handle that.
- The ports
80and443. - If you enable the HAProxy statistics, you must also expose the port defined in
HAPROXY_STATS_PORTenvironment variable (default 1936). Statistics are on by default (HAPROXY_STATS_ENABLE=falseturns them off) and needHAPROXY_PASSWORDto require a login. - Every port defined in
easyhaproxy.[definitions].portalso should be exposed.
For example:
docker run \
/* other parameters */
-p 80:80 \
-p 443:443 \
-p 1936:1936 \
-d byjg/easy-haproxy
Mapping Docker Volume
The docker volume or a way to call the API needs to pass to the EasyHAProxy container.
docker run \
/* other parameters */
-v /var/run/docker.sock:/var/run/docker.sock \
-d byjg/easy-haproxy
Mapping custom .cfg files
You can concatenate valid HAProxy .cfg files to the dynamically generated haproxy.cfg by mapping the folder /etc/easyhaproxy/haproxy/conf.d.
docker run \
/* other parameters */
-v /your/local/conf.d:/etc/easyhaproxy/haproxy/conf.d \
-d byjg/easy-haproxy
Setting Custom Errors
HAProxy answers some requests itself: 404 for a host no service is configured for, 503 when every server of a service is
down, 502/504 when a backend fails or times out, and 400/403/408/500. EasyHAProxy ships a page for each, on by
default; HAPROXY_CUSTOMERRORS=false goes back to HAProxy's built-in ones.
To use your own, map the volume /etc/easyhaproxy/haproxy/errors-custom/ to your container and put a file named
ERROR_NUMBER.http (e.g., 503.http). Each file is a complete HTTP response, status line and headers included, and must
stay under HAProxy's buffer size (16 KB by default).