HTTP Status 426 - Upgrade Required

Der HTTP-Status-Code 426 Upgrade Required signalisiert, dass Server Request nur verarbeitet wenn Client zu einem anderen Protocol upgraded. Typisch für HTTP/1.1 zu HTTP/2 Upgrade, WebSocket-Upgrade-Enforcement oder TLS-Requirement. Response enthält Upgrade-Header mit supported Protocols. Client muss Connection neu aufbauen mit required Protocol.

Typ

Response-Status-Code

Syntax

Der Status Code wird zurückgegeben wenn Protocol-Upgrade erforderlich ist.

http
HTTP/1.1 426 Upgrade Required
Upgrade: HTTP/2.0, HTTP/3
Connection: Upgrade

Direktiven

Der 426 Upgrade Required Status Code wird für Protocol-Upgrade-Enforcement verwendet.

HTTP Version Upgrade
Server verlangt neuere HTTP-Version (z.B. HTTP/2, HTTP/3). Response enthält Upgrade: HTTP/2.0 Header. Client muss neue Connection mit supported Protocol aufbauen.
TLS Enforcement
Server acceptiert nur encrypted Connections. 426 wird für HTTP-Requests returned mit Upgrade: TLS/1.2 oder Upgrade: TLS/1.3. Client muss zu HTTPS upgraden.
WebSocket Requirement
Endpoint verlangt WebSocket-Protocol statt HTTP. Response enthält Upgrade: websocket. Typisch für Real-Time-Communication-Endpoints die nur über WebSocket funktionieren.

Beispiele

Nachfolgend finden Sie praktische Anwendungsbeispiele für Status 426.

Beispiel 1 HTTP/2 Upgrade Requirement

http
GET /api/stream HTTP/1.1
Host: api.example.com

HTTP/1.1 426 Upgrade Required
Upgrade: HTTP/2.0
Connection: Upgrade
Content-Type: application/json

{
  "error": "upgrade_required",
  "message": "This endpoint requires HTTP/2",
  "supported_protocols": ["HTTP/2.0", "HTTP/3"],
  "details": "HTTP/1.1 does not support required server push features"
}

Beispiel 2 TLS Encryption Enforcement

http
GET /api/sensitive-data HTTP/1.1
Host: api.example.com

HTTP/1.1 426 Upgrade Required
Upgrade: TLS/1.3, TLS/1.2
Connection: Upgrade
Strict-Transport-Security: max-age=31536000

{
  "error": "tls_required",
  "message": "This resource requires encrypted connection",
  "redirect": "https://api.example.com/api/sensitive-data",
  "reason": "Sensitive data cannot be transmitted over unencrypted HTTP"
}

Beispiel 3 WebSocket Protocol Required

http
GET /api/live-updates HTTP/1.1
Host: streaming.example.com

HTTP/1.1 426 Upgrade Required
Upgrade: websocket
Connection: Upgrade
Content-Type: text/plain

Error: This endpoint requires WebSocket protocol.
Please connect using WebSocket handshake:
  GET /api/live-updates HTTP/1.1
  Upgrade: websocket
  Connection: Upgrade
  Sec-WebSocket-Key: ...
  Sec-WebSocket-Version: 13

Protocol Upgrade Enforcement Flow

426 Upgrade Required erzwingt HTTP/2-Upgrade für Streaming-Endpoint

Vorteile für die Systemarchitektur

  • Protocol Evolution Enforcement: 426 ermöglicht graceful Migration zu neueren Protocols. Server kann alte Clients informieren dass Upgrade erforderlich ist, statt Request stumm zu rejecten.
  • Feature-Gated Endpoints: Endpoints die spezifische Protocol-Features benötigen (HTTP/2 Server Push, WebSocket bidirectional Communication) können Upgrade enforced. Stellt sicher dass Clients compatible Protocol verwenden.
  • Security Hardening: 426 kann verwendet werden um TLS-Encryption zu enforced für sensitive Endpoints. Verhindert dass Credentials oder sensitive Data über unencrypted HTTP übertragen werden.

Spezifikation

RFC 9110, Section 15.5.22 – HTTP Semantics https://www.rfc-editor.org/rfc/rfc9110.html#name-426-upgrade-required

Weitere Spezifikationen

Upgrade Header, HTTP Status 101 - Switching Protocols