]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: proxy: add option idle-close-on-response
authorWilliam Dauchy <wdauchy@gmail.com>
Wed, 5 Jan 2022 21:53:24 +0000 (22:53 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 6 Jan 2022 08:09:51 +0000 (09:09 +0100)
commita9dd901143385fef3a5113d0bf1681cd0536357a
treedde9c436076f938508136ffd95d2a0050bc4019c
parent6b6631593f408e8a42ca9ae82a0de55ec235e334
MINOR: proxy: add option idle-close-on-response

Avoid closing idle connections if a soft stop is in progress.

By default, idle connections will be closed during a soft stop. In some
environments, a client talking to the proxy may have prepared some idle
connections in order to send requests later. If there is no proper retry
on write errors, this can result in errors while haproxy is reloading.
Even though a proper implementation should retry on connection/write
errors, this option was introduced to support back compat with haproxy <
v2.4. Indeed before v2.4, we were waiting for a last request to be able
to add a "connection: close" header and advice the client to close the
connection.

In a real life example, this behavior was seen in AWS using the ALB in
front of a haproxy. The end result was ALB sending 502 during haproxy
reloads.
This patch was tested on haproxy v2.4, with a regular reload on the
process, and a constant trend of requests coming in. Before the patch,
we see regular 502 returned to the client; when activating the option,
the 502 disappear.

This patch should help fixing github issue #1506.
In order to unblock some v2.3 to v2.4 migraton, this patch should be
backported up to v2.4 branch.

Signed-off-by: William Dauchy <wdauchy@gmail.com>
[wt: minor edits to the doc to mention other options to care about]
Signed-off-by: Willy Tarreau <w@1wt.eu>
doc/configuration.txt
include/haproxy/proxy-t.h
src/mux_h1.c
src/proxy.c