HTTP 400 Bad Request vs 421 Misdirected Request
Both HTTP 400 (Bad Request) and 421 (Misdirected Request) belong to the 4xx Client Error category. 400 indicates that the server cannot process the request due to malformed syntax, invalid request message framing, or deceptive request routing. Meanwhile, 421 means that the request was directed at a server that is unable to produce a response for the combination of scheme and authority in the URI.
Description
The server cannot process the request due to malformed syntax, invalid request message framing, or deceptive request routing.
When You See It
When sending malformed JSON, missing required fields, or invalid query parameters.
How to Fix
Check the request body format, validate all required fields, and ensure proper encoding.
Description
The request was directed at a server that is unable to produce a response for the combination of scheme and authority in the URI.
When You See It
With HTTP/2 when a connection is reused for a domain the certificate doesn't cover.
How to Fix
Retry the request on a new connection.
Key Differences
HTTP 400: The server cannot process the request due to malformed syntax, invalid request message framing, or deceptive request routing.
HTTP 421: The request was directed at a server that is unable to produce a response for the combination of scheme and authority in the URI.
You encounter 400 when when sending malformed JSON, missing required fields, or invalid query parameters.
You encounter 421 when with HTTP/2 when a connection is reused for a domain the certificate doesn't cover.
When to Use Which
For 400 (Bad Request): Check the request body format, validate all required fields, and ensure proper encoding. For 421 (Misdirected Request): Retry the request on a new connection.