HTTP 406 Not Acceptable vs 421 Misdirected Request
Both HTTP 406 (Not Acceptable) and 421 (Misdirected Request) belong to the 4xx Client Error category. 406 indicates that the server cannot produce a response matching the Accept headers sent by the client. 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 produce a response matching the Accept headers sent by the client.
When You See It
When requesting a content type the server doesn't support (e.g., Accept: application/xml when only JSON is available).
How to Fix
Adjust the Accept header to a format the server supports.
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 406: The server cannot produce a response matching the Accept headers sent by the client.
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 406 when when requesting a content type the server doesn't support (e.g., Accept: application/xml when only JSON is available).
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 406 (Not Acceptable): Adjust the Accept header to a format the server supports. For 421 (Misdirected Request): Retry the request on a new connection.