511

Network Authentication Required

Official
network authentication was expected

Specification of the HTTP status code 511

The 511 Network Authentication Required status code indicates that the client needs to authenticate to gain network access. The response representation SHOULD contain a link to a resource that allows the user to submit credentials (e.g., with an HTML form). Note that the 511 Network Authentication Required response SHOULD NOT contain a challenge or the login interface itself, because browsers would show the login interface as being associated with the originally requested URL, which may cause confusion. The 511 Network Authentication Required status SHOULD NOT be generated by origin servers; it is intended for use by intercepting proxies that are interposed as a means of controlling access to the network. Responses with the 511 Network Authentication Required status code MUST NOT be stored by a cache.

Source / Quote by: The 511 Network Authentication Required HTTP Status Code is specified by section 6 of RFC6585.

How to throw a 511 statuscode with PHP?

To throw the HTTP status code 511 on a web page, the PHP function http_response_code can be used. The syntax is as follows: http_response_code(511) (PHP 5 >= 5.4.0, PHP 7, PHP 8)

Test the 511 HTTP status code

In order to be able to display the HTTP status code (in this case 511 Network Authentication Required) and other information on the client side, the development console must be opened with F12. Afterwards you have to navigate to the tab "Network". Now you can open the page, in the network tab you should see the web page (example index.php). This must be selected and then the Herder section must be selected. Here the user will see the following result:

Status code 511 Network Authentication Required
Overview
URL: https://http-statuscode.com/errorCodeExample.php?code=511
Status: 511 Network Authentication Required
Those: Network
IP address: XX.XX.XX.XX
Status code 511 Network Authentication Required

How to create a custom error page for the 511 status code

Creating your own 511 Network Authentication Required error page is relatively easy with the web server "Apache" as well as with the web server "NGINX".

Apache Webserver

The web server "Apache" is one of the most popular web servers on the Internet. To create an own 511 Network Authentication Required error page in "Apache", the following change must be made in the following file.

File: .htaccess
ErrorDocument 511 /errors/511.html

NGINX Webserver

Similar to the web server "Apache", "NGINX" is also widely used on the Internet. To create your own 511 Network Authentication Required error page in "NGINX", the following change must be made in the following file.

File: sites-enabled/default
error_page 511 /511.html;
location = /511.html {
    root /usr/share/nginx/html;
    internal;
}

Browser compatibility of the 511 status code

Chrome no data
Edge no data
Firefox no data
Opera no data
Safari no data
Chrome Android no data
Firefox for Android no data
Opera Android no data
Safari on iOS no data
Internet no data
WebView Android no data

Constants in programming languages

http.StatusNetworkAuthenticationRequired
Response::HTTP_NETWORK_AUTHENTICATION_REQUIRED
:network_authentication_required
Author: Tony Brüser
Author: Tony Brüser

Tony Brüser is an enthusiastic web developer with a penchant for HTTP status codes.

LinkedInGitHub