How to Fix a 408 Request Timeout Error

What does 408 Request Timeout
mean?
A 408 Request Timeout
message is an HTTP status code that is returned to the client when a request to the server takes longer than the server's allocated timeout window. In this case, the server will terminate the connection if it is idle and thus return the 408 Request Timeout
message.
How is a 408
error different from a 504
error?
You may have come across a 504 Gateway Timeout
error in the past and now wonder how that differs from a 408 Request Timeout
error. Although the difference is subtle, there are still differences between both error messages. The 504 Gateway Timeout
error is returned when a server is acting as a gateway or proxy and has timed out. On the other hand, a 408
error is returned as a direct message from the active server itself. According to RFC 2068, the 408 Request Timeout
error is defined as follows:
The client did not produce a request within the time that the server was prepared to wait. The client MAY repeat the request without modifications at any later time.
While the 504 Gateway Timeout
is defined as:
The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server it accessed in attempting to complete the request.
How you might see a 408 Request Timeout
error
There are a few different ways that you might see a 408 Request Timeout
error. The following list outlines a few of these variations that you may see depending upon the web server that is being used. Although they are slightly different, each one means the same thing.
- 408 Request Time-out
- Request Timeout
- The Request Has Timed Out
- 408: Request Timeout
- HTTP Error 408 - Request Timeout
How to fix a 408 Request Timeout
error
In certain cases, it can be difficult to immediately determine the source of an HTTP error. Although 4xx
errors are known to be client side errors, this doesn't mean that the server should be completely ruled out as the culprit. Below are a few things you can check, both on the client and server side in order to try and resolve a 408
error.
Client side
- Double check that the URI is correct: In some cases the URI you request could actually be the cause of the
408
error. Let's say you accidentally request a URL that requires certain credentials to access, depending on how the server is configured, this could trigger a408
response from the server. - Check your internet connection: If there is an issue with your Internet connection or it is very slow, this could cause the request to take too long to complete. Thus, if the server's timeout value is exceeded, a
408
error may be returned. - Try reloading the page: There may be either a temporary issue on the client side or even the server side, try refreshing the page that you are trying to access to see if the issue gets resolved.
Server side
- Check your web server's timeout settings: Web servers such as Apache and Nginx allow web developers to define certain timeout values so that a request isn't open for too long. However, if you are receiving a steady stream of
408
errors, your timeout value might be too small. In the case of Apache, check both the .htaccess file as well as the Apache server config file and look for either theKeepAliveTimeout
orRequestReadTimeout
directives. If either of these directives are defined, try increasing their values, reload the web server and try again. As for Nginx users, open the nginx.conf file and check for directives such asclient_body_timeout
,client_header_timeout
, orkeepalive_timeout
. Same as above, if any of these are found, try increasing their values, reloading the web server and test a few requests. - Check the logs: Whenever you're investigating any sort of HTTP error code it's always a good idea to check your server's error logs. These may provide you with more information about the error and where it is originating from in order to help you resolve the issue.
Summary
A 408 Request Timeout
error is fairly self-explanatory in nature. It essentially tells the client that the request timed out and that the server terminated the connection. If you're experiencing a 408
error, try using the troubleshooting suggestions mentioned in the sections above to hopefully resolve the issue.