HAProxy config generator
A complete haproxy.cfg for HAProxy 2.8 LTS (also fine on 2.4–3.0, differences are noted in the comments). The defaults fit HAProxy terminating TLS in front of Apache on port 80. Settings are kept in the URL; the stats password is not.
Start from
haproxy.cfg
Check and reload
Save the file as /etc/haproxy/haproxy.cfg (keep a copy of the old one), then:
Version notes
- 2.4: everything here works except
ca-file @system-ca(use a CA file path).option httpslogis new in 2.4. - 2.6 / 2.8: the target.
http-check send,http-request return,http-after-responseand the converters used here are all available. - 3.0: same syntax. Adds
%{+json}ofor JSON logs with named fields, and stricter checks of some deprecated keywords; runhaproxy -cafter upgrading. - Old
reqadd/rspadd/reqrepandblockwere removed in 2.1; usehttp-request/http-responserules as below.