511 Network Authentication Required
Usage
The 511 Network Authentication Required status code informs the HTTP client to log in before being granted access to the network. An example of a captive portal is a hotel portal granting guests access to non-public Wi-Fi services.
The 511 Network Authentication Required status code signals to HTTP clients the response is not coming from the origin server but from a network gatekeeper requiring Authentication.
Example
The HTTP client requests a resource and the server responds with a 511 Network Authentication Required status code because the client must first authenticate before being granted regular network access.
Request
GET / HTTP/1.1
Host: example.com
Response
HTTP/1.1 511 Network Authentication Required
Content-Type: text/html; charset=UTF-8
Content-Length: 218
<html>
<head>
<title>Network Authentication Required</title>
</head>
<body>
<p>Before accessing this service,
<a href="https://login.example.re/">sign in
</a> to the network.</p>
</body>
</html>
How to fix
The network requires Authentication before granting internet access. A captive portal is intercepting HTTP traffic and returning 511 until login is complete.
For end users:
For automated clients and applications:
For network operators serving 511:
Code references
.NET
HttpStatusCode.NetworkAuthenticationRequired
Rust
http::StatusCode::NETWORK_AUTHENTICATION_REQUIRED
Rails
:network_authentication_required
Go
http.StatusNetworkAuthenticationRequired
Symfony
Response::HTTP_NETWORK_AUTHENTICATION_REQUIRED
Python3.5+
http.HTTPStatus.NETWORK_AUTHENTICATION_REQUIRED
Apache HttpComponents Core
org.apache.hc.core5.http.HttpStatus.SC_NETWORK_AUTHENTICATION_REQUIRED
Angular
@angular/common/http/HttpStatusCode.NetworkAuthenticationRequired