HTTPError.net

The fastest way to diagnose, understand, and fix any HTTP status code

421 Misdirected Request

Fault: Client
TL;DR

Common with HTTP/2 connection reuse: the connection was reused for a host the server is not configured to serve.

The request was sent to a server that cannot produce a response for the target authority.

What HTTP 421 Misdirected Request Means

The request was sent to a server that cannot produce a response for the target authority.

Common with HTTP/2 connection reuse: the connection was reused for a host the server is not configured to serve.

Common Causes

How to Fix It (For Visitors)

How to Fix It (For Developers/Admins)

Returning a 421 Misdirected Request (Code Examples)

If you build APIs or web apps, here is how to send an HTTP 421 response and how to test for it:

Node.js (Express)

app.get('/resource', (req, res) => {
  res.status(421).json({ error: 'Misdirected Request' });
});

Python (Flask)

@app.route('/resource')
def resource():
    return jsonify(error='Misdirected Request'), 421

PHP

<?php
http_response_code(421);
header('Content-Type: application/json');
echo json_encode(['error' => 'Misdirected Request']);

Check the status with curl

curl -I https://example.com/resource
# Look for: HTTP/1.1 421 Misdirected Request

Frequently Asked Questions

What does HTTP 421 Misdirected Request mean?

Common with HTTP/2 connection reuse: the connection was reused for a host the server is not configured to serve. In short: The request was sent to a server that cannot produce a response for the target authority.

Is 421 Misdirected Request a client or server error?

421 is a 4xx client-error code, so the request itself needs to change. The server is running normally and is rejecting the request as it was sent by the browser, app, or API client.

How do I fix a 421 Misdirected Request error?

Open a fresh connection for the correct authority. Align TLS certificates with server virtual-host config. Disable improper connection coalescing.

Official Specification

The 421 Misdirected Request status code is defined in RFC 9110 Section 15.5.20.

View the IANA HTTP Status Code Registry →