]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: proxy: Add support of 421-Misdirected-Request in retry-on status
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 28 Nov 2024 10:45:51 +0000 (11:45 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 28 Nov 2024 10:47:40 +0000 (11:47 +0100)
The "421" status can now be specified on retry-on directives. PR_RE_* flags
were updated to remains sorted.

This patch should fix the issue #2794. It is quite simple so it may safely
be backported to 3.1 if necessary.

doc/configuration.txt
include/haproxy/proxy-t.h
include/haproxy/proxy.h
src/proxy.c

index 8a7e591df913c205f645f3c42344e832661536c8..1e39eea3fdc66ff3f4c063d9f6318d5a20eeb3ec 100644 (file)
@@ -11760,10 +11760,10 @@ retry-on [space-delimited list of keywords]
 
       <status>          any HTTP status code among "401" (Unauthorized), "403"
                         (Forbidden), "404" (Not Found), "408" (Request Timeout),
-                        "425" (Too Early), "429" (Too Many Requests), "500"
-                        (Server Error), "501" (Not Implemented), "502"
-                        (Bad Gateway), "503" (Service Unavailable), "504"
-                        (Gateway Timeout).
+                       "421" (Misdirected Request), "425" (Too Early),
+                       "429" (Too Many Requests), "500" (Server Error),
+                       "501" (Not Implemented), "502" (Bad Gateway),
+                       "503" (Service Unavailable), "504" (Gateway Timeout).
 
       all-retryable-errors
                         retry request for any error that are considered
index e25e1838b30da31b4cc3518c64537d79d6a89e53..97215c64e93b20cff423cd34ff7ff59f42ab8941 100644 (file)
@@ -192,17 +192,18 @@ enum PR_SRV_STATE_FILE {
 #define PR_RE_403                 0x00000010 /* Retry if we got a 403 */
 #define PR_RE_404                 0x00000020 /* Retry if we got a 404 */
 #define PR_RE_408                 0x00000040 /* Retry if we got a 408 */
-#define PR_RE_425                 0x00000080 /* Retry if we got a 425 */
-#define PR_RE_429                 0x00000100 /* Retry if we got a 429 */
-#define PR_RE_500                 0x00000200 /* Retry if we got a 500 */
-#define PR_RE_501                 0x00000400 /* Retry if we got a 501 */
-#define PR_RE_502                 0x00000800 /* Retry if we got a 502 */
-#define PR_RE_503                 0x00001000 /* Retry if we got a 503 */
-#define PR_RE_504                 0x00002000 /* Retry if we got a 504 */
+#define PR_RE_421                 0x00000080 /* Retry if we got a 421 */
+#define PR_RE_425                 0x00000100 /* Retry if we got a 425 */
+#define PR_RE_429                 0x00000200 /* Retry if we got a 429 */
+#define PR_RE_500                 0x00000400 /* Retry if we got a 500 */
+#define PR_RE_501                 0x00000800 /* Retry if we got a 501 */
+#define PR_RE_502                 0x00001000 /* Retry if we got a 502 */
+#define PR_RE_503                 0x00002000 /* Retry if we got a 503 */
+#define PR_RE_504                 0x00004000 /* Retry if we got a 504 */
 #define PR_RE_STATUS_MASK         (PR_RE_401 | PR_RE_403 | PR_RE_404 | \
-                                   PR_RE_408 | PR_RE_425 | PR_RE_429 | \
-                                   PR_RE_500 | PR_RE_501 | PR_RE_502 | \
-                                   PR_RE_503 | PR_RE_504)
+                                   PR_RE_408 | PR_RE_421 | PR_RE_425 | \
+                                   PR_RE_429 | PR_RE_500 | PR_RE_501 | \
+                                   PR_RE_502 | PR_RE_503 | PR_RE_504)
 /* 0x00000800, 0x00001000, 0x00002000, 0x00004000 and 0x00008000 unused,
  * reserved for eventual future status codes
  */
index 0f4636ea2f72910e234eac5201e24e1450bb890c..066ae6d8f03949c5f029c634484955e26ef515c9 100644 (file)
@@ -205,6 +205,8 @@ static inline int l7_status_match(struct proxy *p, int status)
                return (p->retry_type & PR_RE_404);
        case 408:
                return (p->retry_type & PR_RE_408);
+       case 421:
+               return (p->retry_type & PR_RE_421);
        case 425:
                return (p->retry_type & PR_RE_425);
        case 429:
index d968e7579520c3dd4df4d7099dd50e29c39afc1c..a794771f8380b6b4df8be05d648977ee6517d964 100644 (file)
@@ -877,6 +877,8 @@ proxy_parse_retry_on(char **args, int section, struct proxy *curpx,
                        curpx->retry_type |= PR_RE_404;
                else if (strcmp(args[i], "408") == 0)
                        curpx->retry_type |= PR_RE_408;
+               else if (strcmp(args[i], "421") == 0)
+                       curpx->retry_type |= PR_RE_421;
                else if (strcmp(args[i], "425") == 0)
                        curpx->retry_type |= PR_RE_425;
                else if (strcmp(args[i], "429") == 0)