From: Christopher Faulet Date: Fri, 20 Nov 2020 16:47:47 +0000 (+0100) Subject: MINOR: tcpcheck: Add support of L7OKC on expect rules error-status argument X-Git-Tag: v2.4-dev2~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=83662b5431ceff1b47ba346310deaff9a240d50a;p=thirdparty%2Fhaproxy.git MINOR: tcpcheck: Add support of L7OKC on expect rules error-status argument L7OKC may now be used as an error status for an HTTP/TCP expect rule. Thus it is for instance possible to write: option httpchk GET /isalive http-check expect status 200,404 http-check expect status 200 error-status L7OKC It is more or less the same than the disable-on-404 option except that if a DOWN is up again but still replying a 404 will be set to NOLB state. While it will stay in DOWN state with the disable-on-404 option. --- diff --git a/doc/configuration.txt b/doc/configuration.txt index 3ab2d48892..9d4aa2223c 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -5161,15 +5161,18 @@ http-check expect [min-recv ] [comment ] the last rule in the tcp-check ruleset. "L7OK", "L7OKC", "L6OK" and "L4OK" are supported : - L7OK : check passed on layer 7 - - L7OKC : check conditionally passed on layer 7, for - example 404 with disable-on-404 + - L7OKC : check conditionally passed on layer 7, set + server to NOLB state. - L6OK : check passed on layer 6 - L4OK : check passed on layer 4 By default "L7OK" is used. error-status is optional and can be used to set the check status if an error occurred during the expect rule evaluation. - "L7RSP", "L7STS", "L6RSP" and "L4CON" are supported : + "L7OKC", "L7RSP", "L7STS", "L6RSP" and "L4CON" are + supported : + - L7OKC : check conditionally passed on layer 7, set + server to NOLB state. - L7RSP : layer 7 invalid response - protocol error - L7STS : layer 7 response error, for example HTTP 5xx - L6RSP : layer 6 invalid response - protocol error @@ -11044,15 +11047,18 @@ tcp-check expect [min-recv ] [comment ] the last rule in the tcp-check ruleset. "L7OK", "L7OKC", "L6OK" and "L4OK" are supported : - L7OK : check passed on layer 7 - - L7OKC : check conditionally passed on layer 7, for - example 404 with disable-on-404 + - L7OKC : check conditionally passed on layer 7, set + server to NOLB state. - L6OK : check passed on layer 6 - L4OK : check passed on layer 4 By default "L7OK" is used. error-status is optional and can be used to set the check status if an error occurred during the expect rule evaluation. - "L7RSP", "L7STS", "L6RSP" and "L4CON" are supported : + "L7OKC", "L7RSP", "L7STS", "L6RSP" and "L4CON" are + supported : + - L7OKC : check conditionally passed on layer 7, set + server to NOLB state. - L7RSP : layer 7 invalid response - protocol error - L7STS : layer 7 response error, for example HTTP 5xx - L6RSP : layer 6 invalid response - protocol error diff --git a/src/tcpcheck.c b/src/tcpcheck.c index 282588c1cf..daacc37d6a 100644 --- a/src/tcpcheck.c +++ b/src/tcpcheck.c @@ -3020,6 +3020,8 @@ struct tcpcheck_rule *parse_tcpcheck_expect(char **args, int cur_arg, struct pro err_st = HCHK_STATUS_L7RSP; else if (strcasecmp(args[cur_arg+1], "L7STS") == 0) err_st = HCHK_STATUS_L7STS; + else if (strcasecmp(args[cur_arg+1], "L7OKC") == 0) + err_st = HCHK_STATUS_L7OKCD; else if (strcasecmp(args[cur_arg+1], "L6RSP") == 0) err_st = HCHK_STATUS_L6RSP; else if (strcasecmp(args[cur_arg+1], "L4CON") == 0)