I have a simple goal: I’d like to load balance a couple servers using the
uri hash balance algorithm and I’d like to support persistent connections to and from haproxy with load balancing for each request. Unfortunately, I haven’t been able to achieve this behavior. I’ve tried a variety of configurations, namely
option http-keep-alive, but nothing is working. The configuration file is below.
The behavior I’m witnessing is the hash is used on the first request to bind to a server for the duration of the persistent client connection. I was able to achieve load balancing per request with
option httpclose or
option http-server-close, but those prevent persistent connections. Is there a way to have persistent client and server connections with load balancing on each request?
I’m using HA-Proxy version 1.8.14-52e4d43 2018/09/20
global daemon frontend http-in mode http timeout client 60s option http-keep-alive bind *:8080 default_backend servers backend servers mode http timeout connect 5s timeout server 60s option http-keep-alive balance uri option httpchk GET /health http-check expect status 200 server server1 <ip>:<port> check server server2 <ip>:<port> check