421 Misdirected Request means: The request was directed at a server that cannot produce an authoritative response for the URI's authority — typically a connection-reuse problem in HTTP/2, where a pooled connection serves multiple hostnames and the wrong virtual host answers. Client-error 4xx codes mean the request itself is the problem: malformed syntax, missing credentials, forbidden access, a nonexistent resource or a violated precondition. The server is telling the client what to change; retrying the identical request without a fix will reproduce the same error. In practice you will meet 421 when http/2 connection coalescing reuses a connection for a different hostname; a shared-ip cdn or multi-tenant server receives a request for a host it does not serve; sni/host mismatch after dns changes or certificate sharing. On the client side, retry on a new connection (RFC 9110 explicitly allows this); HTTP/2 stacks should not coalesce connections across unrelated origins. On the server side, configure virtual hosts and certificates so coalesced connections are valid, or return 421 so clients retry elsewhere; check SNI and Host alignment.
When 421 happens
- HTTP/2 connection coalescing reuses a connection for a different hostname
- A shared-IP CDN or multi-tenant server receives a request for a host it does not serve
- SNI/Host mismatch after DNS changes or certificate sharing
How to fix it
On the client
Retry on a new connection (RFC 9110 explicitly allows this); HTTP/2 stacks should not coalesce connections across unrelated origins.
On the server
Configure virtual hosts and certificates so coalesced connections are valid, or return 421 so clients retry elsewhere; check SNI and Host alignment.
Should you retry?
Not retryable as-is: change the request (credentials, payload, URL) first.
Debugging steps
When 421 appears unexpectedly, start by capturing the full exchange: 'curl -i' or the browser DevTools Network tab shows the exact status line and response headers, which often carry the real explanation. Read the error body first — well-designed APIs name the offending field or missing credential. Then diff your actual request, headers included, against the documented contract. For this code specifically, check whether the most common trigger applies to your situation: http/2 connection coalescing reuses a connection for a different hostname. Compare your exchange against the raw HTTP example above. If you operate the server, correlate the timestamp with application and proxy logs using the request id; if you are the client, verify the request shape against the API documentation before changing anything or retrying.
Notes & gotchas
421 is mostly an HTTP/2 connection-coalescing artifact: browsers reuse connections across hostnames when IPs and certificates overlap, and a misrouted request is safely retryable on a fresh connection.
Examples
HTTP/1.1 421 Misdirected Request
Content-Type: application/json
Content-Length: 126
{
"error": "misdirected_request",
"message": "HTTP/2 connection coalescing reuses a connection for a different hostname"
} curl -i https://api.example.com/v1/resource # observe the 421 response and its headers const res = await fetch("https://api.example.com/v1/resource");
if (res.status === 421) {
const problem = await res.json(); // read field-level details
// fix the request (credentials, payload, URL) — identical retries keep failing
throw new RequestError(problem);
} import requests
res = requests.get("https://api.example.com/v1/resource", timeout=10)
if res.status_code == 421:
problem = res.json() # field-level error details
# correct the request before retrying — identical retries keep failing
raise RequestProblem(problem) Frequently asked questions
Why does 421 appear mostly with HTTP/2?
HTTP/2 multiplexes many requests per connection and browsers coalesce connections when IPs and certificates overlap; a reused connection can land on a server that does not serve that hostname.
Is retrying a 421 safe?
Yes — the request was misrouted, not processed, so retrying on a fresh connection is the standard remedy for any method.
Are 4xx errors always the client's fault?
By contract yes — the server asserts the request must change. In practice servers sometimes misuse 4xx for their own problems (e.g. 400 for internal validation bugs), so read the error body before blaming your client code.
Should I retry 4xx responses automatically?
Generally no: the server says the request must change. Exceptions are 408 (fresh connection), 425 (after handshake) and 429 (after Retry-After). Blind retries of 400/401/403/404 just burn quota.
Try the JSON Validator
Check JSON syntax and locate errors by line and column.