Skip to content
4214xx · Client errorThe client seems to have erred. RFC 9110 §15.5

HTTP 421 Misdirected Request: causes and how to fix it

Meaning

HTTP 421 means the server will not answer for that hostname on this connection. Retry on a new connection whose TLS name matches the host.

What to do when a request through a proxy returns 421

The request reached a server over a connection that was set up for a different hostname, and the server refused to answer for it there. RFC 9110 section 15.5.20 defines “421 (Misdirected Request)” as a request directed at a server that “is unable or unwilling to produce an authoritative response for the target URI”. Nothing is wrong with the URL. The connection is the problem, which is why the same section lets a client retry on a different connection “whether or not the request method is idempotent”.

How a request lands on the wrong connection

Both common routes come down to the TLS name (SNI) disagreeing with the HTTP host.

Connection reuse in HTTP/2. RFC 9113 section 9.1.1 lets a client send requests for several hostnames down one connection when the certificate covers all of them, and it says this applies to connections made “either directly or through a tunnel created using the CONNECT method”. If the server picked a backend from the SNI name of the first request, the second hostname arrives at a backend that does not serve it. That backend answers 421. Chromium handles this on its own: its http_network_transaction.cc retries a 421 “with both IP based pooling and Alternative Services disabled”.

A Host header that contradicts SNI. Code that connects to one name and then overrides Host sends SNI for the first name and HTTP for the second. curl -H "Host: ..." does exactly this, and so does a scraper that connects to an IP address and sets Host by hand. The ClientHello study shows where SNI sits in the handshake.

Reproduce it with curl

This Node.js 24.2.0 server holds a certificate for a.test only and answers 421 when the request names any other host:

// node421.mjs
import http2 from 'node:http2';
import fs from 'node:fs';

const server = http2.createSecureServer({
  key: fs.readFileSync('certs/a.test.key'),
  cert: fs.readFileSync('certs/a.test.crt'),
});

server.on('stream', (stream, headers) => {
  const host = (headers[':authority'] || '').split(':')[0];
  const sni = stream.session.socket.servername;   // name from the TLS ClientHello
  if (host !== sni) {
    stream.respond({ ':status': 421, 'content-type': 'text/plain' });
    stream.end(`this connection was made for ${sni}, not ${host}\n`);
    return;
  }
  stream.respond({ ':status': 200, 'content-type': 'text/plain' });
  stream.end(`hello from ${host}\n`);
});

server.listen(37421, '127.0.0.1');

curl 8.23.0 connects for a.test and then asks for b.test. Over HTTP/2 the Host header travels as :authority, and the status line has no reason phrase:

$ curl -skv --resolve a.test:37421:127.0.0.1 -H "Host: b.test" https://a.test:37421/
* ALPN: server accepted h2
*   subject: CN=a.test
> GET / HTTP/2
> Host: b.test
> User-Agent: curl/8.23.0
> Accept: */*
>
< HTTP/2 421
< content-type: text/plain
< date: Wed, 21 Oct 2026 19:58:33 GMT
<
this connection was made for a.test, not b.test

Apache httpd 2.4.67 with two TLS virtual hosts, a.test and b.test, did the same thing without any code. Over HTTP/1.1 it sent HTTP/1.1 421 Misdirected Request with a page saying “the requested host name does not match the Server Name Indication (SNI) in use for this connection”, and wrote this to its error log:

AH02032: Hostname a.test provided via SNI and hostname b.test provided via HTTP have no compatible SSL setup for policy 'secure'

Who sends 421, and who does not

Server When it sends 421 What we saw
Node.js 24.2.0, script above Whenever :authority differs from SNI HTTP/2 421
Apache httpd 2.4.67, mod_ssl SNI and Host pick virtual hosts with incompatible TLS settings 421 over HTTP/1.1 and HTTP/2
nginx Host differs from SNI and the chosen server has ssl_verify_client on Not run; read from the source
Cloudflare edge Not observed 403 Forbidden, three GETs out of three, for SNI www.cloudflare.com and the Host of another zone
Fastly, Google and CloudFront edges Not observed 200 on all four mismatched pairs, three GETs each

The nginx check lives in ngx_http_set_virtual_server(), which logs “client attempted to request the server name different from the one that was negotiated” before finalising with NGX_HTTP_MISDIRECTED_REQUEST. Without client certificates, nginx serves whichever virtual host the Host header names. The edge rows come from 15 curl requests, five SNI and Host pairs with three GETs each, so read them as a spot check, not a survey. None of the 15 returned 421.

What to do when a request through a proxy returns 421

Start from the rule in RFC 9110: “A proxy MUST NOT generate a 421 response.” The status came from the origin or from a gateway acting for it, such as a CDN edge. Through an HTTP CONNECT tunnel the TLS session runs end to end, so the proxy never sees your Host header and cannot be the one comparing it with SNI.

That leaves your client. If it pools tunnels and lets a second hostname ride an HTTP/2 connection opened for the first, RFC 9113 permits that reuse and the origin is entitled to refuse it. Open a fresh tunnel and connection for the retry. Retry once; a second 421 on a brand new connection means the mismatch is in the request itself. With a TLS-intercepting proxy the upstream connection belongs to the proxy, so its pooling, not yours, decides which connection carries the request.

To pin an address without breaking SNI, put the real name in the URL and move the IP to --resolve or --connect-to. Against the Apache pair, with certificate checking on, -H "Host: b.test:37443" on an a.test URL returned 421, while --resolve b.test:37443:127.0.0.1 https://b.test:37443/ returned 200 over HTTP/2. The curl proxy guide covers combining those flags with -x.

Causes and fixes

Cause How to confirm it What to change
Host header overridden in code or with -H curl -v shows a certificate subject for one name and > Host: for another Use the real hostname in the URL; pin the IP with --resolve or your client’s DNS override
HTTP/2 connection shared between hostnames First request on a new connection succeeds; later ones for another host fail Retry on a new connection; stop sharing connections across hosts in your client
Pooled CONNECT tunnel reused for a second host Fails only through the proxy, and only after the first host One tunnel per hostname
Apache virtual hosts with different TLS settings AH02032 in the error log Send matching SNI and Host, or align the virtual hosts’ TLS configuration
nginx server that verifies client certificates “client attempted to request the server name different from the one that was negotiated” at info level Send matching SNI and Host

If you run the origin behind a reverse proxy that routes on SNI, sending 421 is the correct way to push coalescing clients onto their own connection. Returning another site’s content would be the bug.

Frequently asked questions

Is a 421 error my fault or the website's?
Check that the URL name, TLS SNI and Host header match; overriding Host is a common cause.
Can a proxy cause a 421?
RFC 9110 says a proxy MUST NOT generate one, but a client can reuse a tunnel for the wrong hostname.

Sources

  1. RFC 9110 section 15.5.20: 421 Misdirected Request
  2. RFC 9113 section 9.1.1: HTTP/2 connection reuse

All terms, A to Z