HAProxy Config Generator
Generate an HAProxy configuration for HTTP load balancing with TLS termination, an HTTPS redirect, HTTP health checks, sticky sessions and a stats page.
Free · No sign-up · Your inputs stay in your browser
Input
Generate an HAProxy load balancer config
Output
/etc/haproxy/haproxy.cfg
1,176 characters
HAProxy reads the certificate and key from one PEM file: cat fullchain.pem privkey.pem > the .pem named here. A server is taken out after three failed checks two seconds apart and returned after two good ones. Check with haproxy -c -f /etc/haproxy/haproxy.cfg before reloading.
Runs in this browser. Nothing you paste is sent to a server.
About this tool
Method, assumptions, practical next steps, and limits.
Choosing the algorithm
roundrobin sends requests in turn and suits short, uniform requests; leastconn sends each to the server with the fewest open connections and suits uneven or long requests such as uploads and websockets; source hashes the client IP for crude stickiness. The HAProxy documentation lists the rest.
Health checks
With check inter 2s fall 3 rise 2, a server is removed after three failed checks and returned after two good ones. The check should hit an endpoint that tests what the app needs (database, cache) without being expensive, and return 200 only when the instance can serve traffic.