]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: tcpcheck: Add support of L7OKC on expect rules error-status argument
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 20 Nov 2020 16:47:47 +0000 (17:47 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 27 Nov 2020 09:30:23 +0000 (10:30 +0100)
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.

doc/configuration.txt
src/tcpcheck.c

index 3ab2d48892d0fafbaeec3090bdd487773c3fab39..9d4aa2223cb20fe5d0147fe4b8c2e8735f33519b 100644 (file)
@@ -5161,15 +5161,18 @@ http-check expect [min-recv <int>] [comment <msg>]
                        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 <st>  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 <int>] [comment <msg>]
                        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 <st>  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
index 282588c1cfd97b53560710cfa5b6064e02ca958a..daacc37d6af96d433d2756344e47ec0e65582bf9 100644 (file)
@@ -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)