429 Too Many Requests: Retry-After in 7 HTTP Clients
What happens to your request next?
With default settings, none of the measured clients sent the request again after a 429 in this measurement; the 429 came back to the calling code.
“The 429 status code indicates that the user has sent too many requests in a given amount of time ("rate limiting").” — RFC 6585 §4
Reading the measurements
Read the input, observation, and outcome columns together.
Measured on Linux (x86_64, kernel 7.0.0-34-generic) against a local test server over the loopback interface, with curl 8.18.0, GNU Wget 1.25.0, Python urllib.request 3.12.13, Python Requests 2.34.2, Python HTTPX 0.28.1, Node.js fetch 20.20.2, Chromium fetch() 149.0.7827.55 (urllib3 2.7.0 under Requests, httpcore 1.0.9 under HTTPX, undici 6.24.1 under Node.js), each run twice. Retry-After values of 2 and 4 seconds, dates 2 to 5 seconds ahead in the three HTTP-date formats, no header, and the invalid value “soon” were measured; longer waits, other invalid values, other versions and settings, Windows, macOS, Firefox and Safari were not measured.
| Client | Retry-After sent | Requests seen | Result | Calling code got |
|---|---|---|---|---|
| curl 8.18.0 | 2 (seconds) | 1 | not sent again; the 429 came back | status 429, exit code 0 |
| curl 8.18.0 | IMF-fixdate | 1 | not sent again; the 429 came back | status 429, exit code 0 |
| curl 8.18.0 | no header | 1 | not sent again; the 429 came back | status 429, exit code 0 |
| GNU Wget 1.25.0 | 2 (seconds) | 1 | not sent again; the 429 came back | exit code 8 |
| GNU Wget 1.25.0 | IMF-fixdate | 1 | not sent again; the 429 came back | exit code 8 |
| GNU Wget 1.25.0 | no header | 1 | not sent again; the 429 came back | exit code 8 |
| Python urllib.request 3.12.13 | 2 (seconds) | 1 | not sent again; the 429 came back | status 429 as HTTPError; Retry-After readable, same as sent |
| Python urllib.request 3.12.13 | IMF-fixdate | 1 | not sent again; the 429 came back | status 429 as HTTPError; Retry-After readable, same as sent |
| Python urllib.request 3.12.13 | no header | 1 | not sent again; the 429 came back | status 429 as HTTPError; no Retry-After to read |
| Python Requests 2.34.2 | 2 (seconds) | 1 | not sent again; the 429 came back | status 429; Retry-After readable, same as sent |
| Python Requests 2.34.2 | IMF-fixdate | 1 | not sent again; the 429 came back | status 429; Retry-After readable, same as sent |
| Python Requests 2.34.2 | no header | 1 | not sent again; the 429 came back | status 429; no Retry-After to read |
| Python HTTPX 0.28.1 | 2 (seconds) | 1 | not sent again; the 429 came back | status 429; Retry-After readable, same as sent |
| Python HTTPX 0.28.1 | IMF-fixdate | 1 | not sent again; the 429 came back | status 429; Retry-After readable, same as sent |
| Python HTTPX 0.28.1 | no header | 1 | not sent again; the 429 came back | status 429; no Retry-After to read |
| Node.js fetch 20.20.2 | 2 (seconds) | 1 | not sent again; the 429 came back | status 429; Retry-After readable, same as sent |
| Node.js fetch 20.20.2 | IMF-fixdate | 1 | not sent again; the 429 came back | status 429; Retry-After readable, same as sent |
| Node.js fetch 20.20.2 | no header | 1 | not sent again; the 429 came back | status 429; no Retry-After to read |
| Chromium fetch() 149.0.7827.55 | 2 (seconds) | 1 | not sent again; the 429 came back | status 429; Retry-After readable, same as sent |
| Chromium fetch() 149.0.7827.55 | IMF-fixdate | 1 | not sent again; the 429 came back | status 429; Retry-After readable, same as sent |
| Chromium fetch() 149.0.7827.55 | no header | 1 | not sent again; the 429 came back | status 429; no Retry-After to read |
Comparing the measured cases
| Client and setting | Method | Retry-After sent | Target | Measured | Repeated request | Result |
|---|---|---|---|---|---|---|
| curl 8.18.0 with --retry 1 | GET | 2 (seconds) | 2 s | 2.0 s | GET | inside the target band |
| curl 8.18.0 with --retry 1 | GET | 4 (seconds) | 4 s | 4.0 s | GET | inside the target band |
| curl 8.18.0 with --retry 1 | GET | IMF-fixdate | 3.0 s | 3.0 s | GET | inside the target band |
| curl 8.18.0 with --retry 1 | GET | IMF-fixdate | 5.0 s | 5.0 s | GET | inside the target band |
| curl 8.18.0 with --retry 1 | GET | RFC 850 date | 3.0 s | 3.0 s | GET | inside the target band |
| curl 8.18.0 with --retry 1 | GET | RFC 850 date | 5.0 s | 5.0 s | GET | inside the target band |
| curl 8.18.0 with --retry 1 | GET | asctime date | 3.0 s | 3.0 s | GET | inside the target band |
| curl 8.18.0 with --retry 1 | GET | asctime date | 5.0 s | 5.0 s | GET | inside the target band |
| curl 8.18.0 with --retry 1 | GET | no header | — | 1.0 s | GET | sent again (no target) |
| curl 8.18.0 with --retry 1 | GET | “soon” (invalid) | — | 1.0 s | GET | sent again, as with no header |
| curl 8.18.0 with --retry 1 | POST | 2 (seconds) | 2 s | 2.0 s | POST with its body | inside the target band |
| curl 8.18.0 with --retry 1 | POST | 4 (seconds) | 4 s | 4.0 s | POST with its body | inside the target band |
| curl 8.18.0 with --retry 1 | POST | IMF-fixdate | 3.0 s | 3.0 s | POST with its body | inside the target band |
| curl 8.18.0 with --retry 1 | POST | IMF-fixdate | 5.0 s | 5.0 s | POST with its body | inside the target band |
| curl 8.18.0 with --retry 1 | POST | RFC 850 date | 3.0 s | 3.0 s | POST with its body | inside the target band |
| curl 8.18.0 with --retry 1 | POST | RFC 850 date | 5.0 s | 5.0 s | POST with its body | inside the target band |
| curl 8.18.0 with --retry 1 | POST | asctime date | 3.0 s | 3.0 s | POST with its body | inside the target band |
| curl 8.18.0 with --retry 1 | POST | asctime date | 5.0 s | 5.0 s | POST with its body | inside the target band |
| curl 8.18.0 with --retry 1 | POST | no header | — | 1.0 s | POST with its body | sent again (no target) |
| curl 8.18.0 with --retry 1 | POST | “soon” (invalid) | — | 1.0 s | POST with its body | sent again, as with no header |
| GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429 | GET | 2 (seconds) | 2 s | 1.0 s | GET | earlier than the target band |
| GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429 | GET | 4 (seconds) | 4 s | 1.0 s | GET | earlier than the target band |
| GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429 | GET | IMF-fixdate | 3.0 s | 1.0 s | GET | earlier than the target band |
| GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429 | GET | IMF-fixdate | 5.0 s | 1.0 s | GET | earlier than the target band |
| GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429 | GET | RFC 850 date | 3.0 s | 1.0 s | GET | earlier than the target band |
| GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429 | GET | RFC 850 date | 5.0 s | 1.0 s | GET | earlier than the target band |
| GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429 | GET | asctime date | 3.0 s | 1.0 s | GET | earlier than the target band |
| GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429 | GET | asctime date | 5.0 s | 1.0 s | GET | earlier than the target band |
| GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429 | GET | no header | — | 1.0 s | GET | sent again (no target) |
| GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429 | GET | “soon” (invalid) | — | 1.0 s | GET | sent again, as with no header |
| GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429 | POST | 2 (seconds) | 2 s | 1.0 s | POST with its body | earlier than the target band |
| GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429 | POST | 4 (seconds) | 4 s | 1.0 s | POST with its body | earlier than the target band |
| GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429 | POST | IMF-fixdate | 3.0 s | 1.0 s | POST with its body | earlier than the target band |
| GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429 | POST | IMF-fixdate | 5.0 s | 1.0 s | POST with its body | earlier than the target band |
| GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429 | POST | RFC 850 date | 3.0 s | 1.0 s | POST with its body | earlier than the target band |
| GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429 | POST | RFC 850 date | 5.0 s | 1.0 s | POST with its body | earlier than the target band |
| GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429 | POST | asctime date | 3.0 s | 1.0 s | POST with its body | earlier than the target band |
| GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429 | POST | asctime date | 5.0 s | 1.0 s | POST with its body | earlier than the target band |
| GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429 | POST | no header | — | 1.0 s | POST with its body | sent again (no target) |
| GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429 | POST | “soon” (invalid) | — | 1.0 s | POST with its body | sent again, as with no header |
| Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) | GET | 2 (seconds) | 2 s | 2.0 s | GET | inside the target band |
| Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) | GET | 4 (seconds) | 4 s | 4.0 s | GET | inside the target band |
| Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) | GET | IMF-fixdate | 3.0 s | 3.0 s | GET | inside the target band |
| Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) | GET | IMF-fixdate | 5.0 s | 5.0 s | GET | inside the target band |
| Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) | GET | RFC 850 date | 3.0 s | 3.0 s | GET | inside the target band |
| Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) | GET | RFC 850 date | 5.0 s | 5.0 s | GET | inside the target band |
| Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) | GET | asctime date | 3.0 s | 3.0 s | GET | inside the target band |
| Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) | GET | asctime date | 5.0 s | 5.0 s | GET | inside the target band |
| Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) | GET | no header | — | 0.0 s | GET | sent again (no target) |
| Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) | GET | “soon” (invalid) | — | — | — | not sent again; the code got InvalidHeader |
| Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) | POST | 2 (seconds) | 2 s | — | — | not sent again; the 429 came back |
| Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) | POST | 4 (seconds) | 4 s | — | — | not sent again; the 429 came back |
| Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) | POST | IMF-fixdate | 3.0 s | — | — | not sent again; the 429 came back |
| Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) | POST | IMF-fixdate | 5.0 s | — | — | not sent again; the 429 came back |
| Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) | POST | RFC 850 date | 3.0 s | — | — | not sent again; the 429 came back |
| Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) | POST | RFC 850 date | 5.0 s | — | — | not sent again; the 429 came back |
| Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) | POST | asctime date | 3.0 s | — | — | not sent again; the 429 came back |
| Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) | POST | asctime date | 5.0 s | — | — | not sent again; the 429 came back |
| Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) | POST | no header | — | — | — | not sent again; the 429 came back |
| Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) | POST | “soon” (invalid) | — | — | — | not sent again; the 429 came back |
With retries turned on and Retry-After sent as a value in seconds, in this measurement the wait followed it for curl 8.18.0 with --retry 1 (GET and POST); Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) (GET); the wait did not follow it for GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429 (GET and POST); the request was not sent again by Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) (POST).
With retries turned on and Retry-After sent as an HTTP date in the IMF-fixdate format, in this measurement the wait followed it for curl 8.18.0 with --retry 1 (GET and POST); Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) (GET); the wait did not follow it for GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429 (GET and POST); the request was not sent again by Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) (POST).
curl 8.18.0 with --retry 1: after a 429 to a POST, the POST arrived again with its body in this measurement.
GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429: after a 429 to a POST, the POST arrived again with its body in this measurement.
Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]): after a 429 to a POST, the POST was not sent again in this measurement.
curl 8.18.0 with --retry 1, GET: with the invalid Retry-After value “soon”, in this measurement the request came back after about as long as with no Retry-After header.
curl 8.18.0 with --retry 1, POST: with the invalid Retry-After value “soon”, in this measurement the request came back after about as long as with no Retry-After header.
GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429, GET: with the invalid Retry-After value “soon”, in this measurement the request came back after about as long as with no Retry-After header.
GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429, POST: with the invalid Retry-After value “soon”, in this measurement the request came back after about as long as with no Retry-After header.
Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]), GET: with the invalid Retry-After value “soon”, in this measurement the request was not sent again and the calling code got InvalidHeader.
Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]), POST: with the invalid Retry-After value “soon”, in this measurement the request was not sent again and the 429 came back to the calling code without an exception.
The source passages
With retries turned on and Retry-After sent as an HTTP date in the older RFC 850 format, in this measurement the wait followed it for curl 8.18.0 with --retry 1 (GET and POST); Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) (GET); the wait did not follow it for GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429 (GET and POST); the request was not sent again by Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) (POST).
With retries turned on and Retry-After sent as an HTTP date in the older asctime format, in this measurement the wait followed it for curl 8.18.0 with --retry 1 (GET and POST); Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) (GET); the wait did not follow it for GNU Wget 1.25.0 with --tries=2 --retry-on-http-error=429 (GET and POST); the request was not sent again by Python Requests 2.34.2 with urllib3 Retry(total=1, status_forcelist=[429]) (POST).
“The response representations SHOULD include details explaining the condition, and MAY include a Retry-After header indicating how long to wait before making a new request.” — RFC 6585 §4
“The Retry-After field value can be either an HTTP-date or a number of seconds to delay after receiving the response.” — RFC 9110 §10.2.3
“A recipient that parses a timestamp value in an HTTP field MUST accept all three HTTP-date formats.” — RFC 9110 §5.6.7
Which input and configuration match your case?