HTTP Status 421 - Misdirected Request

Der HTTP-Status-Code 421 Misdirected Request signalisiert, dass Request über eine Connection gesendet wurde, die für diesen Origin-Server nicht autorisiert ist. Typisch bei HTTP/2 Connection-Reuse wenn Server-Certificate nicht für alle Hosts auf derselben IP gültig ist. Client muss Request über neue Connection wiederholen.

Typ

Response-Status-Code

Syntax

Der Status Code wird zurückgegeben bei falsch gerouteten HTTP/2-Requests.

http
HTTP/1.1 421 Misdirected Request

Direktiven

Der 421 Misdirected Request Status Code wird bei HTTP/2-Connection-Misrouting verwendet.

HTTP/2 Connection Reuse
HTTP/2 erlaubt Connection-Reuse für mehrere Hosts auf derselben IP-Adresse. Wenn Server-Certificate nicht für alle Hosts gültig ist, returned Server 421 für misdirected Requests.
TLS Certificate Mismatch
Server kann Request nicht verarbeiten weil TLS-Certificate nicht für requested Authority (Host+Port) gültig ist. Client muss neue TLS-Connection für korrekten Host aufbauen.
Retry on New Connection
Client sollte Request automatisch über neue dedizierte Connection zum Origin-Server wiederholen. 421 ist explizites Signal dass Connection-Reuse für diesen Host nicht funktioniert.

Beispiele

Nachfolgend finden Sie praktische Anwendungsbeispiele für Status 421.

Beispiel 1 HTTP/2 Connection Reuse Failure

http
GET /api/users HTTP/2
Host: api.example.com
:authority: api.example.com

HTTP/2 421 Misdirected Request
Content-Type: application/json

{
  "error": "misdirected_request",
  "message": "This connection is not authorized for api.example.com",
  "details": "TLS certificate only valid for cdn.example.com",
  "action": "Retry request on new connection"
}

Beispiel 2 Certificate Subject Mismatch

http
GET /data HTTP/2
Host: secure.example.com
:authority: secure.example.com

HTTP/2 421 Misdirected Request
Content-Type: text/plain

Error: Request misdirected. Server certificate does not cover secure.example.com.
Certificate valid for: www.example.com, api.example.com
Please establish new connection to secure.example.com.

Beispiel 3 Shared Connection Rejection

http
POST /api/orders HTTP/2
Host: shop.example.com
:authority: shop.example.com
Content-Type: application/json

{"product_id": 42, "quantity": 2}

HTTP/2 421 Misdirected Request
Content-Type: application/json

{
  "status": 421,
  "error": "connection_not_authorized",
  "message": "Current connection cannot be used for shop.example.com",
  "retry": "Client should retry on dedicated connection"
}

HTTP/2 Connection Reuse Rejection Flow

421 Misdirected Request bei HTTP/2-Connection-Reuse mit Certificate-Mismatch

Vorteile für die Systemarchitektur

  • Security Boundary Enforcement: 421 verhindert dass Requests über Connections geroutet werden, für die Server nicht autorisiert ist. Schützt vor Certificate-Mismatch-Attacks und versehentlichem Host-Confusion.
  • HTTP/2 Optimization Guidance: Client lernt, dass Connection-Reuse für bestimmte Host-Kombinationen nicht funktioniert. Kann zukünftige Requests direkt über dedizierte Connections routen.
  • Transparent Retry Mechanism: 421 ermöglicht automatisches Client-Retry ohne User-Intervention. Client kann Request seamless über korrekte Connection wiederholen, User merkt Fehler nicht.

Spezifikation

RFC 9110, Section 15.5.22 – HTTP Semantics https://www.rfc-editor.org/rfc/rfc9110.html#name-421-misdirected-request

Weitere Spezifikationen

Host Header, Alt-Svc Header