Find out why your server stopped waiting for the request

408 Request Timeout means the server didn't receive a complete request within the time it was prepared to wait, so it gave up and closed the connection. Unlike a 504, the delay is on the way in: the browser or app was slow to send the headers or the body. Large uploads over slow connections and read timeouts set too short both cause it, and so do idle connections browsers open ahead of time, which show up as 408s in your logs with no page request behind them.

Where 408s come from

  • Connections the browser opened early

    Browsers can open a connection before they need it. If no request follows, some servers send a 408 on that idle connection and close it, so the log shows a 408 that no visitor asked for.

  • Slow uploads

    A large file sent over a slow or unsteady connection can stall long enough for the server's read timeout to run out partway through the body.

  • A short read timeout

    The web server and any load balancer in front of it each decide how long to wait for headers and body. Set too low, they cut off visitors on slow networks who would have finished.

  • Clients that stall

    A script, app or device that opens a request and stops sending, or a visitor whose network drops mid-request, leaves the server waiting until its timer ends.

MDN notes that some servers send 408 on idle connections, more often since browsers began opening connections ahead of time. nginx applies its body timeout to each gap between reads rather than the whole upload, with a 60-second default, as its documentation says, and Amazon's load balancer sends 408 when a client sends no data before the idle timeout, according to its troubleshooting guide.

Find which requests ended in 408

# See which server answers visitors first, so you know whose timeout to check
curl -sI https://yoursite.com/ | grep -iE '^(HTTP|server)'

# List the request lines that ended in 408, most common first (combined log format)
grep '" 408 ' access.log | awk -F'"' '{print $2}' | sort | uniq -c | sort -rn | head

Read what the 408s were

  • An empty request line, or a dash, means the connection closed before any request arrived. Those are most likely the idle connections browsers open early, and you can leave them alone. A list led by one upload or form address points to slow request bodies on that route, and that's where visitors are losing work.

  • Then compare the timeouts along the path. A CDN, a load balancer and the web server each wait for the request on their own clock, and whichever gives up first sends the 408. The Server header from the first command shows which layer talks to visitors directly. RFC 9110 defines the status as the server running out of the time it was prepared to wait.

How to fix a 408 Request Timeout error

  1. Leave idle-connection 408s aloneIf a 408 has no request line behind it, no visitor lost a page. Filter these out of error alerts and reports rather than raising timeouts to make them go away.
  2. Give upload routes more timeRaise the body read timeout for the routes that take large files, at every layer between the visitor and your app, and keep the shorter default everywhere else so stalled clients don't hold connections open.
  3. Send large files in piecesSplit big uploads into chunks the browser sends one at a time, or send them straight to file storage, so no single request has to survive minutes on a weak connection.
  4. Let a failed upload retryShow the size limit and progress on upload forms and offer a retry when a request fails, instead of leaving the visitor at a bare error page.

Frequently asked questions

What's the difference between 408 and 504?

A 408 means your server waited too long for the request to arrive. A 504 means a proxy waited too long for your server's response. The first is slow traffic coming in, and the second is a slow answer going out; the 504 Gateway Timeout guide linked below covers that one.

Is it safe to retry after a 408?

Usually, on a new connection. RFC 9110 lets a client repeat a request that was still in transit when the 408 arrived, because the server never processed it. For an upload, start it again from the beginning or from the last chunk the server confirmed.