408 Request Timeout

Client Error - Server timed out waiting for request

HTTP 408 Request Timeout

What It Means

The HTTP 408 Request Timeout status code indicates that the server did not receive a complete request from the client within the time it was prepared to wait. The server is closing the connection.

408 vs 504

  • 408: Server waiting for client to send request
  • 504: Server waiting for upstream server to respond

Common Causes

  • Slow client connection: Poor network conditions
  • Large request body: Uploading big files on slow connection
  • Client paused: Application stopped sending data mid-request
  • Network interruption: Packet loss or connectivity issues
  • Keep-alive timeout: Idle connection timed out

Example Response

HTTP/1.1 408 Request Timeout
Connection: close
Content-Type: text/html

<html>
<body>
  <h1>Request Timeout</h1>
  <p>The server timed out waiting for your request.</p>
</body>
</html>

Server Configuration

Nginx

# Client request timeout settings
http {
    client_header_timeout 60s;  # Time to receive headers
    client_body_timeout 60s;    # Time to receive body
    send_timeout 60s;           # Time between writes
    keepalive_timeout 75s;      # Idle connection timeout
}

Apache

# Timeout for client to send request
Timeout 60

# Keep-alive settings
KeepAliveTimeout 5

Client-Side Handling

async function fetchWithRetry(url, options, retries = 3) {
  for (let i = 0; i < retries; i++) {
    try {
      const response = await fetch(url, options);
      if (response.status === 408) {
        console.log('Request timeout, retrying...');
        continue;
      }
      return response;
    } catch (error) {
      if (i === retries - 1) throw error;
    }
  }
}

Debugging Tips

  1. Check your network connection speed
  2. Try smaller payloads to isolate the issue
  3. Monitor request timing in browser DevTools
  4. Check server timeout configuration
  5. Look for network interruptions (VPN, proxy)

Prevention

  • Use chunked uploads for large files
  • Implement progress indicators for long uploads
  • Consider increasing timeout for slow endpoints
  • Add retry logic for transient failures

Frequently Asked Questions

What does HTTP 408 Request Timeout mean?
HTTP 408 Request Timeout means the server waited too long for the client to finish sending its request and is closing the connection. This is different from 504 Gateway Timeout, which occurs when a proxy or gateway is waiting for an upstream server. The 408 error is about the client being too slow to complete its request.
What is the difference between 408 and 504?
A 408 Request Timeout means the server is waiting for the client to send its request. A 504 Gateway Timeout means a proxy or gateway server is waiting for a response from an upstream server. In short: 408 is client-to-server timeout, 504 is server-to-server timeout.
How do I fix a 408 Request Timeout error?
Common fixes include: checking your network connection for slow speeds or packet loss, reducing the size of the request payload, using chunked transfer encoding for large uploads, increasing the server timeout configuration, and implementing retry logic in your client code.
Can a 408 error be retried safely?
Yes. HTTP 408 is considered a retryable status code. The server is telling the client that the connection timed out, and the client can safely retry the request. Many HTTP client libraries and browsers will automatically retry on 408 responses.
How do I configure server timeout settings?
In Nginx, set client_header_timeout and client_body_timeout directives. In Apache, use the Timeout and KeepAliveTimeout directives. In Node.js/Express, set server.timeout or server.keepAliveTimeout properties. Default values vary by server but are typically 60-120 seconds.

Monitor request timeouts

Track timeout errors and optimize your endpoints.

Start monitoring free →

Related Status Codes

More Resources