Q:

HAProxy doesn't keep-alive http connection

I've switched on the option http-keep-alive in the defaults, as well as tried it in the frontend definition.
But the Response Headers in the browser never show up keep-alive, although its there in Request Headers of the browser. Using Chrome as a browser.
The backend for haproxy is an apache 2.4 + php-fpm. HAProxy ver 1.5.3
Thanks

A:

@felix-frank is right.
To check if keep-alive is supported or not simply execute this command :
curl -Iv http://www.serverfault.com/ 2>&1 | grep -i 'connection #0'

Result (Keep-alive disabled) :
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Closing connection #0

Another test with keep-alive enabled :
curl -Iv http://www.google.com/ 2>&1 | grep -i 'connection #0'

Result ( Keep-alive enabled) :
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connection #0 to host www.google.com left intact
* Closing connection #0

A:

It would appear that your assumption is that haproxy will add a
Connection: keep-alive

header. That is not the case. Instead, the keep-alive mode (KAL, default in 1.5.x) will just refrain from closing connections or adding Connection: close headers.
Your configuration is probably fine. You can test keepalive using nc for example, or ab -k.

