HAProxy doesn’t keep-alive http connection

haproxyhttpkeep-alive

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

Best Answer

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.