HTTP Headers
Retry After
The HTTP Retry-After
response header specifies the amount of time a user agent should wait before making a subsequent request.
It is typically used in specific situations, including:
- In a
503 Service Unavailable
response, this header indicates the duration the service expects to be unavailable. - In a
429 Too Many Requests
response, it suggests the wait time before retrying the request. - In redirect responses like
301 Moved Permanently
, it advises the minimum waiting period before issuing the redirected request.
Syntax
Syntax
Retry-After: <http-date>
Retry-After: <delay-seconds>
Directives
Directives
These directives specify instructions related to HTTP responses.
<http-date>
A date indicating when to retry a request. This is used in conjunction with the Retry-After header to inform clients about the appropriate wait time before making subsequent requests. The date should be formatted following the standard HTTP date format.
<delay-seconds>
A non-negative decimal number representing the number of seconds to wait before retrying the request after receiving the response.
Example
Dealing with scheduled downtime
Support for the Retry-After
header on both clients and servers remains inconsistent.
Nonetheless, certain crawlers and spiders, such as Googlebot, recognize and respect the Retry-After
header.
Sending this header with a 503
response is beneficial, as it informs search engines to continue
indexing your website once the scheduled downtime has concluded.
Example:
Retry-After: Wed, 21 Oct 2015 07:28:00 GMT
Retry-After: 120
How to Modify Header using Requestly
- Install and open the Requestly Chrome extension. You can find it on the Chrome Web Store.
- Create a new rule: Click on “Create Rule” and choose “Modify Headers” from the list of available rule types.
- Add a new header modification:
- Under “Action”, select “Add” or “Override”.
- In the “Header Name” field, enter Retry-After.
- In the “Header Value” field, enter the desired retry duration in seconds or a HTTP-date (e.g., 120 or Wed, 21 Oct 2025 07:28:00 GMT).
- Set the URL condition: Specify the URL or pattern where this header change should apply (e.g., https://your-api.com/*).
- Save the rule.
Once set up, Requestly will inject the Retry-After header into all matching responses, helping you simulate how clients handle retry timing and improve the robustness of your application’s error handling.
You might need to modify the Retry-After header to test how your application behaves when a server asks clients to wait before trying again. This is useful for handling rate limits or temporary outages gracefully during development.
Table of Contents
- No headings found.