421 Misdirected Request
The request reached a server that cannot answer for this hostname and scheme, often because an HTTP/2 connection was reused.
What 421 Misdirected Request means
With HTTP/2 and HTTP/3, a browser can reuse one connection for several hostnames that share an IP address and TLS certificate. If the server on that connection is not configured for the requested host, it answers 421.
The client can retry on a new connection. The fix is almost always in the server's TLS and virtual host setup.
Common causes
- A wildcard or multi-domain certificate shared by sites that run on different servers or with different TLS settings.
- A reverse proxy or CDN receiving traffic for a hostname it does not serve.
- The TLS SNI name and the Host header pointing to different sites.
How to fix 421 Misdirected Request
- As a visitor, reload the page, which can open a fresh connection.
- Give each site its own certificate, or serve every hostname on a shared certificate from the same server config.
- Check that the proxy's server_name or host routing includes the hostname being requested.
Example response
HTTP/1.1 421 Misdirected Request
Content-Type: text/plain; charset=utf-8
421 Misdirected RequestHow to check for a 421 response
cURL
# Print only the status code
curl -s -o /dev/null -w "%{http_code}\n" https://example.com/JavaScript (Node.js)
const res = await fetch("https://example.com/");
if (res.status === 421) {
console.log(res.status, res.statusText);
}Python
import requests
res = requests.get("https://example.com/")
if res.status_code == 421:
print(res.status_code, res.reason)Go
res, err := http.Get("https://example.com/")
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
if res.StatusCode == 421 {
fmt.Println(res.Status)
}Specification
421 Misdirected Request is defined in RFC 9110, section 15.5.20.
Related status codes
- 400
The server could not understand the request because something in it is malformed, like broken JSON, bad syntax or invalid headers.
- 502
A server acting as a gateway or proxy got an invalid response, or no usable response, from the upstream server behind it.
- 404
The server cannot find anything at this URL. The page may have moved or been deleted, or the link may have a typo.