408 Request Timeout

HTTP Status CodesClient (4xx)commonStatus Code: 408Last updated: todayTested on:Google ChromeNode.js v20 LTSJune 2026

The server timed out waiting for the request from the client.

408 Request Timeout Quick Fix⏱️ Est. Fix Time: 4 minutes

Usually happens because:

  • Client connection dropped mid-stream due
  • Slow client connections failing to

🔍 Quick Checklist:

Meaning

The HTTP 408 Request Timeout client error status code indicates that the server would like to shut down this unused connection. It is sent on idle connections by servers to free up resources.

Root Causes

  • Client connection dropped mid-stream due to network loss.
  • Slow client connections failing to transmit headers/body parameters within server timeout limits.
CauseFrequency
Client connection dropped mid-stream due⭐⭐⭐⭐⭐
Slow client connections failing to⭐⭐⭐⭐

Common Mistakes

  • Confusing 408 with 504 Gateway Timeout (use 408 when the *client* takes too long; use 504 when upstream backend servers take too long).
  • Keeping client timeouts shorter than server timeouts, resulting in unhandled connection resets.

How to Fix

1Verify client network stability.
2Increase server idle timeout settings (e.g., keepalive_timeout in Nginx).
3Optimize payload streaming packet sizes.

Framework-Specific Examples

Using timeout middleware in Express to return 408 on slow uploads.

Express Example
const timeout = require('connect-timeout');
app.use(timeout('5s'));
app.use((req, res, next) => {
  if (req.timedout) res.status(408).send('Request Timeout');
});

Server Configuration Examples

Setting client header/body timeouts in Nginx.

Nginx Config
client_header_timeout 10s;
client_body_timeout 10s;
keepalive_timeout 15s;

Prevention

  • Configure sensible server connection limits to recycle idle sockets safely.
  • Implement client-side retries with backoff strategies.

Frequently Asked Questions (FAQ)

Q: What is the difference between 408 and 504?

408 Request Timeout means the server waited too long for the *client* to send its request. 504 Gateway Timeout means a proxy/gateway waited too long for an *upstream backend server* to reply.

Q: Does 408 close the connection?

Yes. A 408 response typically includes a 'Connection: close' header, and the server closes the underlying TCP socket immediately.

Q: Can search engine crawlers trigger 408?

No, unless crawler network conditions are extremely poor. If search engines receive recurring 408s, they will reduce crawling frequency.

Q: How do browsers handle 408 errors?

Most browsers retry the request automatically in the background on a new socket connection before displaying an error to the user.

Still having this problem?

Didn't solve your problem?

SuggestRequest Error