511 Network Authentication Required
HTTP response status code 511 Network Authentication Required is a server error used by captive portals to inform HTTP clients that they need to complete a sign-in after connecting to a network.
When the 511 Network Authentication Required status code is received, it is being used to inform the HTTP client that it needs to log in before being granted access to the network. An example of a captive portal is a hotel portal granting their guests access to non-public Wi-Fi services.
The use of the 511 Network Authentication Required status code is used so that HTTP clients will know that the HTTP response is not coming from the origin server. Rather, it is coming from a gatekeeper.
In the example, the HTTP client requests a resource and the server responds with a 511 Network Authentication Required status code because the HTTP client must first authenticate before being granted regular access to the network.
GET / HTTP/1.1 Host: www.example.re
HTTP/1.1 511 Network Authentication Required Content-Type: text/html; charset=UTF-8 Content-Length: 199 <html> <head> <title>Network Authentication Required</title> </head> <body> <p>Before accessing this service, you must <a href="https://login.example.re/">Login</a>.</p> </body> </html>
Apache HttpComponents Core
The 511 Network Authentication Required status code informs the HTTP client that it has reached a captive portal and must authenticate before being granted access to the network.