We occasionally use haproxy to return a static API response (using the errorfile directive).
However, we’ve noticed that when we do so, haproxy closes the connection (instead of respecting the Connection: Keep-Alive
header).
Is there any way to get haproxy to keep the connection alive, instead of closing it right away?
I’ve tried various permuations of setting option http-keep-alive, option httpclose, forcepersist, to no avail. We use haproxy 1.8.
Here’s the backend configuration:
### backend for blackholing heartbeats
backend mybackend
mode http
errorfile 503 /srv/www/response.http
Here are the contents of the errorfile:
HTTP/1.1 200 Ok
Content-Type: application/json; charset=utf-8
Connection: Keep-Alive
Content-Length: 17
{"success":false}