diff --git a/doc/configuration.txt b/doc/configuration.txt index 128447dc0..c82959053 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -2905,6 +2905,10 @@ http-check expect [!] waste some CPU cycles, especially when regular expressions are used, and that it is always better to focus the checks on smaller resources. + Also "http-check expect" doesn't support HTTP keep-alive. Keep in mind that it + will automatically append a "Connection: close" header, meaning that this + header should not be present in the request provided by "option httpchk". + Last, if "http-check expect" is combined with "http-check disable-on-404", then this last one has precedence when the server responds with 404. diff --git a/src/checks.c b/src/checks.c index feca96e2f..1b5b7319b 100644 --- a/src/checks.c +++ b/src/checks.c @@ -1427,6 +1427,9 @@ static int connect_conn_chk(struct task *t) else if ((check->type) == PR_O2_HTTP_CHK) { if (s->proxy->options2 & PR_O2_CHK_SNDST) bo_putblk(check->bo, trash.str, httpchk_build_status_header(s, trash.str, trash.size)); + /* prevent HTTP keep-alive when "http-check expect" is used */ + if (s->proxy->options2 & PR_O2_EXP_TYPE) + bo_putstr(check->bo, "Connection: close\r\n"); bo_putstr(check->bo, "\r\n"); *check->bo->p = '\0'; /* to make gdb output easier to read */ }