What 511 means
You need to sign in to the network before you can reach the internet. It’s sent by captive portals, the sign-in pages on hotel, airport, train and café Wi-Fi, not by the website you were trying to reach.
When servers send it
When a network intercepts your request before you’ve accepted the terms or logged in. RFC 6585 says origin servers should not send it.
Common causes
- Public Wi-Fi with a sign-in page you haven’t completed.
- A network session that has timed out.
How to fix it as a developer
- Your app’s requests may get 511 (or a redirect, or a fake 200 page) on such networks. Treat it as “no internet yet” and tell the user to sign in to the Wi-Fi.
- The response should contain a link to the sign-in page.
How to fix it as a visitor
- Open any web page (an http:// one works best) to bring up the Wi-Fi sign-in page, then accept the terms or log in.
- Reconnect to the Wi-Fi if the session has expired.
Related codes
- 401 Unauthorized: You need to log in, or the credentials you sent are missing, wrong or expired.
- 407 Proxy Authentication Required: Like 401, but it’s a proxy between you and the server that wants you to log in.
- 403 Forbidden: The server understood who you are and won’t let you do this.
Where it’s defined
511 Network Authentication Required is defined in RFC 6585, section 6. It’s a 5xx code, the server error class: the server, or something behind it, failed to deal with a valid request.
Other 5xx codes
500 Internal Server Error · 501 Not Implemented · 502 Bad Gateway · 503 Service Unavailable · 504 Gateway Timeout · 505 HTTP Version Not Supported · 520 Web Server Returned an Unknown Error · 521 Web Server Is Down · 522 Connection Timed Out · 523 Origin Is Unreachable · 524 A Timeout Occurred · 525 SSL Handshake Failed · 526 Invalid SSL Certificate
Or search them all in the HTTP status code list.