What does HTTP status code 421 mean?
The 421 Misdirected Request status code indicates that the client directed its request to a server that is unable to generate a response for the combination of scheme and authority in the request.
When to use it in APIs
Useful in HTTP/2 and HTTP/3 settings, where connections are commonly reused (coalesced) across multiple hostnames that share an IP address and TLS certificate. If a client reuses such a connection to request a hostname the server isn’t actually configured to serve, the server returns 421 to tell the client to retry on a fresh connection instead.
How it compares to other codes
- 404 Not Found: Implies the path doesn’t exist on this host, whereas 421 implies the request reached the wrong host entirely.