What 511 Network Authentication Required means
511 Network Authentication Required is the captive-portal status code. When a public WiFi network requires you to log in (hotel, airport, coffee shop), a properly-configured network gateway returns 511 with a body pointing at the login page. Most captive portals do not actually use 511; they intercept all HTTP traffic with a redirect to the login page, which is messier but more compatible with broken clients.
When servers should return it: Return 511 from network gateways when the client has not authenticated to the network.
Common causes
- Public WiFi captive portal not yet logged into
- Network requires SSO authentication before allowing internet access
How to fix 511 Network Authentication Required
- Open a browser, navigate to any HTTP page, complete the captive portal login
- Use a known captive-portal-detection URL (Apple/Google/MS all have these)
Example response
HTTP/1.1 511
content-type: text/html
<html><body>You must <a href="https://wifi.example.com/login">log in to the network</a>.</body></html>
More references
For a one-page reference of all HTTP status codes, see the HTTP cheat sheet. For testing API responses, try the API Tester tool. For inspecting responses on the command line, the curl cheat sheet covers the most common flags.