Errors and troubleshooting
What does HTTP 408 Request Timeout mean?
It means the server stopped waiting for your client. The connection was open, but the full request (headers or body) did not arrive within the server's time limit, so it replied 408 and closed the connection.
The answer
A 408 is about the request side, not the response. The server accepted a connection and then sat waiting for your request line, headers or body to finish arriving. When its timer ran out, it answered 408 and usually closed the connection. That separates it from a 504, where a gateway waited too long for an upstream server, and from a client-side timeout, where your own code gave up waiting for an answer. The status code entry lists the neighbors.
Why scrapers see it
Idle keep-alive connections
HTTP clients reuse connections from a pool. Some servers send a 408 on a connection that has been idle too long, just before closing it. If your client picks that connection for the next request, it may receive the stale 408 or a connection reset. This is the most common source of occasional, random 408s in scrapers, and it is harmless: retry on a fresh connection.
Slow or overloaded proxies
A proxy that buffers or stalls can deliver your request to the target in pieces with long gaps. The target sees a client that started talking and then went quiet. Patterns of 408s concentrated on certain proxies point here.
Large or slow uploads
Posting big forms or files over a slow link can exceed the server's body timeout. So can a client that opens the connection and then computes the body (for example, waiting on a CAPTCHA answer) before sending it.
Deliberate slowness checks
Servers defend against slow-request attacks by enforcing tight header timeouts. A client that dribbles headers, which some hand-rolled socket code does, runs into them.
How to fix it
- Retry once on a new connection. A single 408 is often a pooled-connection artifact. Most HTTP libraries retry idempotent requests safely; for POSTs, decide case by case.
- Prepare before connecting. Build the full request, including any CAPTCHA token, before opening the connection, rather than holding a connection open while you wait.
- Check proxy health. Track 408s per proxy, as you would other errors, and rest the slow ones.
- Tune pool idle time. Close idle connections sooner than the server does so you never pick a stale one.
An example with retries in Python
import requests
from urllib3 import Retry
retrying_client = requests.Session()
retry_rule = Retry(total=3, backoff_factor=0.8,
status_forcelist=[408, 502, 503, 504],
allowed_methods=["GET", "HEAD"])
retrying_client.mount("https://", requests.adapters.HTTPAdapter(max_retries=retry_rule))
listing = retrying_client.get("https://catalog.example.net/page/3", timeout=(5, 30))
The retry rule covers 408 and gateway errors for safe methods, with a growing delay between attempts. The timeout tuple sets five seconds to connect and thirty to read; see ConnectTimeout in Python Requests for those limits.
When 408s come in bulk
Many 408s in a row, especially from one site, can mean the site is slowing deliberate abuse or that your traffic pattern resembles a slow attack. Lower concurrency, check that your client sends complete requests promptly, and look at whether the 408s come with other blocking signals such as 403, 429 or challenge pages. The timeout entry explains how to set limits on your side so slow servers do not stall your workers either.
Reading the response correctly
Some servers send the 408 with a short HTML body and a Connection: close header, others just close the socket, which your library reports as a disconnect or a reset rather than a status code. Treat both the same way in your retry logic. Log which one you got along with the proxy and the time since the connection was last used; that pair of facts usually separates stale-connection noise from a genuinely slow path.
Is a 408 ever related to CAPTCHA solving?
Only indirectly. If your code opens a request to the target, then waits for a token before writing the body, the server's timer may expire. Solve first, then send the request in one go. The GateSolver API itself replies to each call quickly; you poll for the result in separate short requests, so a long solve never holds a connection open.
Common questions
Is HTTP 408 a client or server error?
It is a 4xx code, so it points at the client: the request did not arrive in time, even when the cause is a slow network.
Should I retry after a 408?
Yes, once or twice on a fresh connection. Single 408s are often caused by stale pooled connections.
How is 408 different from 504?
408 means the server waited for your request; 504 means a gateway waited for an upstream server's response.
Can a proxy cause 408 errors?
Yes. A stalled or overloaded proxy can deliver requests too slowly for the target's timeout.
Does solving a CAPTCHA cause 408s?
Only if you hold a connection open while waiting for the answer. Solve first, then send the request.
Keep reading
- TimeoutConnect, read and total timeouts for HTTP calls, plus the separate deadline for an asynchronous task such as a CAPTCHA solve.
- HTTP status codeThe three digit codes servers answer with, and what 200, 301, 403, 429 and 503 usually mean for a scraper.
- How do I deal with 504 Gateway Timeout?A 504 means a gateway waited too long for the server behind it; retry later, lighten requests and check slow proxies.
- How do I fix ConnectTimeout in Python Requests?ConnectTimeout means no TCP connection opened in time: check DNS, host, port, firewall and proxy, then add timeouts and retries.