HAProxy http-reuse never option not working for HAProxy 1.9.8 and 2.0.1

To my knowledge – i.e. without looking in the source code, but based on what I’ve read through the mailing lists – the following is how things worked in 1.8 (and previous versions) regarding HTTP keep-alive and HTTP reuse:

  • first of all, a connection’s lifetime, between the HAProxy backend and the selected server, is tied to the lifetime of the connection between the client and the HAProxy frontend;
  • i.e. HAProxy didn’t have any sort of “connection pool”; (in fact if one used a round-robin load-balancing algorithm, and there were multiple servers, no server connection would have been reused regardless if it was for the same client…)
  • thus the emerging behavior you’ve seen by using http-keep-alive, namely if you had multiple servers, no connection would have been reused;

(In fact http-reuse refers to the fact that another client connection can (or shouldn’t) reuse an existing server connection opened by the original client connection. This is due to some badly implemented web-servers would assume that an inbound connection always belongs to the same “user”.)

Now in HAProxy 2.0, I think they’ve started to implement a sort of “connection pool” on the server side, thus even if you set http-reuse never it means that the same “client connection” could reuse its own initiated connections to a bunch of servers.

As Lukas said, if you really need to close the server connection after each request (as I do when the server is on 127.0.0.1), then you need to use http-close.