421 Misdirected Request

HTTP response status code 421 Misdirected Request is returned by the server to indicate that it has received a request that was not intended for it. This status code was introduced in HTTP/2.

The response is cacheable by default. If the default behavior needs to be overridden then the response must include the appropriate HTTP caching headers.

Usage

When the 421 Misdirected Request error message is received, it indicates that the server is unable to produce a response. This status may be sent as a result of connection reuse, where the server does not want clients to reuse connections. In response, a client can try to resubmit the request over a different connection.

This may also occur when an alternative service (Alt-Svc) is selected.

This status will not be generated by proxies.

Note

Search engines like Google will not index a URL with 421 Misdirected Request response status, and consequently, URLs that have been indexed in the past but are now returning this HTTP status code will be removed from the search results.

Example

In the example, the client requests a resource and the server responds with the 421 Misdirected Request error message because it has received a request that was not intended for it.

Request

GET /tech-news HTTP/2
Host: www.example.re

Response

HTTP/2 421 Misdirected Request

Code references

.NET

HttpStatusCode.MisdirectedRequest

Rust

http::StatusCode::MISDIRECTED_REQUEST

Rails

:misdirected_request

Go

http.StatusMisdirectedRequest

Symfony

Response::HTTP_MISDIRECTED_REQUEST

Python3.5+

http.HTTPStatus.MISDIRECTED_REQUEST

Apache HttpComponents Core

org.apache.hc.core5.http.HttpStatus.SC_MISDIRECTED_REQUEST

Angular

@angular/common/http/HttpStatusCode.MisdirectedRequest

Takeaway

The 421 Misdirected Request status code is a client error sent by a server that is unable to produce a response. The client may retry the request using another connection.

See also

Last updated: August 2, 2023