408

Request Timeout

Official
The time for the request has expired

General explanation of the 408 status code

The HTTP status code 408 Request Timeout occurs when a request from a client (e.g. a web browser) to a server takes too long to be fully sent or completed. The server only waits a certain amount of time for all the necessary data to arrive and terminates the connection if this time limit is exceeded. This error can be caused by a slow or unstable internet connection, technical problems with the client or server, or requests that are too large or complex. For the user, this often manifests itself in the fact that a website does not load completely or the connection is suddenly interrupted. A new request - for example by refreshing the page - often solves the problem, but it can also be useful to check your own internet connection or server availability.

Specification of the HTTP status code 408

The 408 Request Timeout status code indicates that the server did not receive a complete request message within the time that it was prepared to wait. A server SHOULD send the "close" connection option (Section 6.1 of [RFC7230]) in the response, since 408 Request Timeout implies that the server has decided to close the connection rather than continue waiting. If the client has an outstanding request in transit, the client MAY repeat that request on a new connection.

Source / Quote by: The 408 Request Timeout HTTP Status Code is specified by section 6.5.7 of RFC7231.

How to throw a 408 statuscode with PHP?

To throw the HTTP status code 408 on a web page, the PHP function http_response_code can be used. The syntax is as follows: http_response_code(408) (PHP 5 >= 5.4.0, PHP 7, PHP 8)

Test the 408 HTTP status code

In order to be able to display the HTTP status code (in this case 408 Request Timeout) and other information on the client side, the development console must be opened with F12. Afterwards you have to navigate to the tab "Network". Now you can open the page, in the network tab you should see the web page (example index.php). This must be selected and then the Herder section must be selected. Here the user will see the following result:

Status code 408 Request Timeout
Overview
URL: https://http-statuscode.com/errorCodeExample.php?code=408
Status: 408 Request Timeout
Those: Network
IP address: XX.XX.XX.XX
Status code 408 Request Timeout

How do I solve the problem with the 408 status code?

For website operators, the HTTP status code 408 Request Timeout "Request Timeout" is usually an indication that the server is overloaded or the timeout settings are too short. A first step should be to check the server resources and ensure that sufficient CPU, memory and bandwidth are available. If the server regularly reaches its capacity limits, it may be necessary to scale or optimize the infrastructure. The server's timeout settings should also be checked and adjusted if necessary to allow more time for processing incoming requests. In addition, a Content Delivery Network (CDN) can help to deliver content faster, especially for users who are geographically distant. Server logs often provide valuable information about the causes of timeouts and should be analyzed regularly. In addition, the website should be checked for large or complex requests that can possibly be optimized or split into smaller units to reduce server load. A user-friendly error page that gives users helpful instructions on how to revisit the page rounds off the measures.

For users who encounter a 408 Request Timeout error, there are some simple solutions to fix the problem. It is often sufficient to reload the page, as the error is often only temporary. If the problem persists, it is advisable to check your own internet connection, as slow or unstable connections are often the cause. Restarting the router or using a different network can help here. If the error continues to occur, it could be due to outdated or faulty browser data. Deleting the cache and cookies and testing with a different browser or device can help. Security programs such as firewalls or proxy settings that could be restricting the data flow should also be checked. With these measures, the error can often be rectified so that the connection to the website can be restored.

How to create a custom error page for the 408 status code

Creating your own 408 Request Timeout error page is relatively easy with the web server "Apache" as well as with the web server "NGINX".

Apache Webserver

The web server "Apache" is one of the most popular web servers on the Internet. To create an own 408 Request Timeout error page in "Apache", the following change must be made in the following file.

File: .htaccess
ErrorDocument 408 /errors/408.html

NGINX Webserver

Similar to the web server "Apache", "NGINX" is also widely used on the Internet. To create your own 408 Request Timeout error page in "NGINX", the following change must be made in the following file.

File: sites-enabled/default
error_page 408 /408.html;
location = /408.html {
    root /usr/share/nginx/html;
    internal;
}

Browser compatibility of the 408 status code

Chrome no data
Edge no data
Firefox no data
Opera no data
Safari no data
Chrome Android no data
Firefox for Android no data
Opera Android no data
Safari on iOS no data
Internet no data
WebView Android no data

Constants in programming languages

HttpStatusCode.RequestTimeout
http.StatusRequestTimeout
Response::HTTP_REQUEST_TIMEOUT
httplib.REQUEST_TIMEOUT
http.client.REQUEST_TIMEOUT
http.HTTPStatus.REQUEST_TIMEOUT
:request_timeout
Author: Tony Brüser
Author: Tony Brüser

Tony Brüser is an enthusiastic web developer with a penchant for HTTP status codes.

LinkedInGitHub