HTTP Status 511 - Network Authentication Required

Der HTTP-Status-Code 511 Network Authentication Required signalisiert, dass Client Network-Level-Authentication durchführen muss bevor Network-Access gewährt wird. Typisch bei Captive-Portals in WiFi-Hotspots, Hotel-Networks oder Public-Internet-Access-Points. User muss in Browser-Login-Page authentifizieren bevor Internet-Requests durchgelassen werden.

Typ

Response-Status-Code

Syntax

Der Status Code wird zurückgegeben bei Captive-Portal-Interception.

http
HTTP/1.1 511 Network Authentication Required

Direktiven

Der 511 Network Authentication Required Status Code wird für Captive-Portal-Authentication verwendet.

Captive Portal Detection
Network-Gateway intercepted Request und returned 511 statt actual Response. Client detected dass Network-Authentication erforderlich ist bevor Internet-Access gewährt wird. Typisch bei Public-WiFi, Airport-Networks.
Browser-Based Authentication
User muss Browser öffnen und Authentication-Page completieren (Login, Terms-Acceptance, Payment). Nach successful Authentication erlaubt Gateway Internet-Access. 511 signalisiert dass dieser Process noch pending ist.
Network-Level Access Control
511 ist Network-Infrastruktur-Response, nicht Origin-Server-Response. Intermediate-Gateway (Router, Firewall, Proxy) returniert 511 um Authentication zu enforced. Unterscheidet sich von 401 (Server-Authentication).

Beispiele

Nachfolgend finden Sie praktische Anwendungsbeispiele für Status 511.

Beispiel 1 WiFi Hotspot Captive Portal

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

HTTP/1.1 511 Network Authentication Required
Content-Type: text/html
Content-Length: 1024

<!DOCTYPE html>
<html>
<head><title>WiFi Authentication Required</title></head>
<body>
  <h1>Welcome to Free WiFi</h1>
  <p>You must authenticate before accessing the internet.</p>
  <form action="https://hotspot.example.com/login" method="POST">
    <label>Email: <input type="email" name="email" required></label>
    <label>Accept Terms: <input type="checkbox" name="terms" required></label>
    <button type="submit">Connect to Internet</button>
  </form>
</body>
</html>

Beispiel 2 Hotel Network Access Portal

http
GET https://www.google.com/ HTTP/1.1
Host: www.google.com

HTTP/1.1 511 Network Authentication Required
Content-Type: application/json
Location: https://portal.hotel-network.com/auth

{
  "error": "network_authentication_required",
  "message": "Hotel network requires authentication",
  "portal_url": "https://portal.hotel-network.com/auth",
  "instructions": "Open browser and complete authentication at portal",
  "room_number_required": true
}

Beispiel 3 Corporate Guest WiFi

http
GET /app/api/endpoint HTTP/1.1
Host: app.example.com
User-Agent: MyApp/1.0

HTTP/1.1 511 Network Authentication Required
Content-Type: text/plain
X-Captive-Portal: https://guest-wifi.company.com/

Network Authentication Required

You are connected to Corporate Guest WiFi.
Internet access requires authentication.

Steps:
1. Open web browser
2. Navigate to: https://guest-wifi.company.com/
3. Enter guest credentials or request access
4. Retry your application request after authentication

Contact IT Support: support@company.com

Captive Portal Authentication Flow

511 Network Authentication Required bei Captive-Portal-Interception

Vorteile für die Systemarchitektur

  • Captive Portal Transparency: 511 macht Captive-Portal-Presence explicit. Applications können 511 detected und User informieren dass Browser-Authentication erforderlich ist, statt cryptic Network-Errors zu zeigen.
  • User Experience Guidance: Modern Operating-Systems und Browsers können 511 automatisch handeln durch Captive-Portal-Detection. Öffnen automatisch Authentication-Page, User-Experience ist seamless.
  • Network Access Control: 511 ermöglicht Network-Operators flexible Access-Control-Policies. Guest-WiFi, Paid-Hotspots, Terms-Acceptance können enforced werden bevor Internet-Access gewährt wird.

Spezifikation

RFC 6585, Section 6 – Additional HTTP Status Codes https://www.rfc-editor.org/rfc/rfc6585.html#section-6

Weitere Spezifikationen

HTTP Status 401 - Unauthorized, WWW-Authenticate Header