408 Request Timeout

HTTP response status code 408 Request Timeout is a client error that is returned by the server to indicate that a request is coming in too slowly from a client and it is unwilling to wait for it to be completed, thus terminating the connection.

Usage

When the 408 Request Timeout error message is received, it means that a client has initiated a request but for some reason, it has not been transmitted in full. This may occur because an internet connection is very slow, or has been dropped. The response will include the Connection header, specifying that it has been closed.

Upon receiving the Connection: close header, the client can attempt the request again.

Note

Search engines like Google will not index a URL with 408 Request Timeout response status, and consequently, URLs that have been indexed in the past but are now returning this HTTP status code will be removed from the search results.

Example

In the example, the client begins to send a 10K PDF file to the server, but the connection is suffering from intermittent connectivity issues and the server concludes that the transmission, in its entirety, is too slow. As such, it cancels the HTTP request and closes the connection. Sometime later, when the connection is more stable, the client attempts to retransmit the file and it is successful.

Initial request

PUT /docs HTTP/1.1
Host: www.example.re
Content-Type: applications/pdf
Content-Length: 10000

Initial response

HTTP/1.1 408 Request Timeout
Connection: Close
Content-Type: text/html
Content-Length: 198

<html>
  <head>
    <title>Connection Close</title>
  </head>
  <body>
   <p>The transmission was not received quickly enough. Check internet connectivity and please try again.</p>
  </body>
</html>

Next request

PUT /docs HTTP/1.1
Host: www.example.re
Content-Type: applications/pdf
Content-Length: 10000

<File transfer successful for PDF file>

Final response

HTTP/1.1 200 OK

Code references

.NET

HttpStatusCode.RequestTimeout

Rust

http::StatusCode::REQUEST_TIMEOUT

Rails

:request_timeout

Go

http.StatusRequestTimeout

Symfony

Response::HTTP_REQUEST_TIMEOUT

Python3.5+

http.HTTPStatus.REQUEST_TIMEOUT

Java

java.net.HttpURLConnection.HTTP_CLIENT_TIMEOUT

Apache HttpComponents Core

org.apache.hc.core5.http.HttpStatus.SC_REQUEST_TIMEOUT

Angular

@angular/common/http/HttpStatusCode.RequestTimeout

Takeaway

The 408 Request Timeout status code is a client error that the server sends when an HTTP request is taking too long to complete. Common reasons for this are slow or broken internet connections. If the connection is restored, the client can make the request again.

See also

Last updated: August 2, 2023