HAProxy Config Audit Guide
Last updated:
An HAProxy config audit is a static review of a load balancer’s configuration file — haproxy.cfg — checked line by line against known-good practice, without connecting to the proxy. The file decides who can open the stats page, which TLS versions still negotiate, how long a slow client may hold a connection, and whether a frontend’s backend actually exists. This guide walks through the findings that matter most, the inheritance trap in defaults, mode mismatches and phantom backends — then shows you how to run the same audit yourself with the HAProxy Config Auditor.
What an HAProxy config audit actually checks
A config audit reads the file the way HAProxy reads it: sections first (global, defaults, then one frontend, backend or listen per proxy), then the directives inside each. Because a setting that is simply absent leaves a built-in default in force, an audit checks absence as carefully as presence — no maxconn, no timeouts and no logging are findings, not neutral facts.
Each finding is anchored to evidence: the line number, the section and the directive exactly as written. That is what makes an audit repeatable — run it before and after a change and the two reports diff cleanly, which is why the auditor exports findings as CSV and the full report as JSON.
The findings that matter most: stats, TLS and timeouts
An exposed stats interface is the finding to fix first. stats enable or stats uri without stats auth in the same section is an admin panel with no login, and a stats socket bound to a TCP address with level admin lets anyone who can reach the port drain servers and change weights. Close behind come legacy TLS: an ssl-min-ver of TLSv1.0 or TLSv1.1, or cipher lists still offering RC4, 3DES or DES.
Missing timeouts are the quiet availability risk. A proxy whose effective configuration lacks timeout connect, timeout client or timeout server lets connections sit open indefinitely — exactly what a slowloris-style trickle of half-sent requests exploits. The demo below is a small config that trips all three families at once and scores 29 out of 100.
How defaults inheritance hides gaps
Settings in a defaults section flow into the proxies that follow it — and only those. A proxy defined above the defaults block inherits nothing from it, and a second defaults block further down silently replaces the first for everything after it. Reading one proxy in isolation therefore tells you almost nothing; the audit resolves each proxy’s effective mode, timeouts and logging before judging it.
The classic accident is the timeout set in the wrong place: an operator adds timeout client to one busy frontend, sees the warning disappear there, and never notices the other three proxies still run without it. Inheritance-aware findings name the section and list exactly which timeouts are missing after inheritance, so the gap is a line you can point at.
Mode mismatches and phantom backends
A frontend in mode http whose default_backend runs mode tcp — or the reverse — is a wiring fault that often survives review because each section looks fine alone. HTTP features such as header rewriting and ACLs on paths quietly stop applying, or a raw-TCP backend receives requests it cannot parse. The audit follows every default_backend and use_backend reference and compares the effective modes at both ends.
The same reference check catches phantom backends: a name that no backend or listen section defines, usually a rename that updated one side of the file and not the other. HAProxy will complain at reload — the worst possible moment to learn about it. A static audit finds it while the file is still an editor buffer.
The five mistakes the auditor flags most
First, stats turned on for a quick look and never protected. Second, a TLS floor set years ago — TLSv1.0 as the minimum, a cipher string copied from an old post with RC4 still in it, DH parameters left at 1024. Third, timeouts present in defaults but missing in the one proxy added later, above the block. Fourth, option http_proxy left in a frontend from a debugging session, quietly making the listener an open proxy.
Fifth, the operational blind spots: no log target anywhere, no option httplog on HTTP proxies, no option forwardfor so applications see only the proxy’s IP, and backend hostnames resolved once at startup with no resolvers section and no init-addr. None of these break the config syntax — all of them break something later, at runtime, in production.
What a static audit cannot see — and auditing yours in five minutes
A static audit reads text, not a running system. It cannot see the certificate files a crt path points to, whether backends are actually healthy, runtime statistics, the defaults of your HAProxy version, or whether a firewall already blocks the stats port. Treat the score as a property of the file, and verify the deployment separately with live checks.
To audit yours: open the HAProxy Config Auditor, paste your haproxy.cfg or drop the file — it is parsed in your browser and never uploaded — and read the findings top-down, errors first. Fix, re-paste, and watch the score move. Compare with the sibling guides for the other layers of the same stack: the Nginx Config Auditor and the Apache Config Auditor.
A broken demo config, as audited
# Demo HAProxy config — deliberately broken. Do not deploy.
global
stats socket [email protected]:9999 level admin
tune.ssl.default-dh-param 512
ssl-default-bind-ciphers ECDHE-RSA-AES128-SHA:RC4-SHA
defaults
mode http
timeout connect 5s
frontend web
bind *:80
bind *:443 ssl crt /etc/haproxy/site.pem ssl-min-ver TLSv1.0
stats enable
stats uri /stats
option http_proxy
default_backend app_tcp
backend app_tcp
mode tcp
server app1 app.example.com:8080 check