Retry-After

The HTTP Retry-After response header tells the client how long they is expected to wait before making a follow-up HTTP request.

Usage

The HTTP Retry-After response header is sent by a server to tell the client that it needs to wait before sending a subsequent HTTP request. The time can be specified as a period, measured in seconds, or instead lists a specific date and time at which the client can send a follow-up HTTP request. The HTTP Retry-After header is sent for several reasons, including:

  • If the HTTP Retry-After header is sent as part of a HTTP 301 Moved Permanently response, it specifies the minimum amount of time that the client is expected to wait before redirecting the HTTP request.
  • When the HTTP Retry-After header is sent with error 402 Too Many Requests, it simply refers to how long the client is expected to wait before trying again. Ideally, the server will direct the client to a time when it is less busy.
  • The server reports the resource or service as unavailable in a 503 Service Unavailable response. The HTTP Retry-After header is understood to be when the resource will be available again.

Example

In this example, the server is directing the client to wait for at least 30 seconds before retrying the HTTP request.

Retry-After: 30

Takeaway

The Retry-After header is used to ask the client to wait before sending a follow-up HTTP request. It can be a specific time or instead, a delay specified in seconds.

See also

Last updated: June 2, 2022