]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: proxy: Add support of 429-Too-Many-Requests in retry-on status
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 27 Aug 2024 17:09:08 +0000 (19:09 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 28 Aug 2024 08:05:34 +0000 (10:05 +0200)
The "429" status can now be specified on retry-on directives. PR_RE_* flags
were updated to remains sorted.

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

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

index 155aa1a9022834826f591f3968c9b69a09e77d89..26d63e6692c386ccdd4e36789be00ec72a4a6224 100644 (file)
@@ -11337,9 +11337,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), "500" (Server Error), "501" (Not
-                        Implemented), "502" (Bad Gateway), "503" (Service
-                        Unavailable), "504" (Gateway Timeout).
+                        "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 eb6a22427bf19f2228926ace64ec410d1ef93245..74b4ab6d643bc7b53ef1a38c2e676cc753e1e21c 100644 (file)
@@ -193,15 +193,16 @@ enum PR_SRV_STATE_FILE {
 #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_500                 0x00000100 /* Retry if we got a 500 */
-#define PR_RE_501                 0x00000200 /* Retry if we got a 501 */
-#define PR_RE_502                 0x00000400 /* Retry if we got a 502 */
-#define PR_RE_503                 0x00000800 /* Retry if we got a 503 */
-#define PR_RE_504                 0x00001000 /* Retry if we got a 504 */
+#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_STATUS_MASK         (PR_RE_401 | PR_RE_403 | PR_RE_404 | \
-                                   PR_RE_408 | PR_RE_425 | PR_RE_500 | \
-                                   PR_RE_501 | PR_RE_502 | PR_RE_503 | \
-                                   PR_RE_504)
+                                   PR_RE_408 | 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 25dd136dadd43fa2e9bd031be237dd29de775633..89a337081f8e331af8288f0c771d034135285eac 100644 (file)
@@ -855,6 +855,8 @@ proxy_parse_retry_on(char **args, int section, struct proxy *curpx,
                        curpx->retry_type |= PR_RE_408;
                else if (strcmp(args[i], "425") == 0)
                        curpx->retry_type |= PR_RE_425;
+               else if (strcmp(args[i], "429") == 0)
+                       curpx->retry_type |= PR_RE_429;
                else if (strcmp(args[i], "500") == 0)
                        curpx->retry_type |= PR_RE_500;
                else if (strcmp(args[i], "501") == 0)