416

Range Not Satisfiable

Official
The requested areas cannot be provided

Specification of the HTTP status code 416

The 416 Range Not Satisfiable status code indicates that none of the ranges in the request's Range header field (Section 3.1) overlap the current extent of the selected resource or that the set of ranges requested has been rejected due to invalid ranges or an excessive request of small or overlapping ranges.

For byte ranges, failing to overlap the current extent means that the first-byte-pos of all of the byte-range-spec values were greater than the current length of the selected representation. When this status code is generated in response to a byte-range request, the sender SHOULD generate a Content-Range header field specifying the current length of the selected representation (Section 4.2).

For example:

HTTP/1.1 416 Range Not Satisfiable
Date: Fri, 20 Jan 2012 15:41:54 GMT
Content-Range: bytes */47022

Note: Because servers are free to ignore Range, many implementations will simply respond with the entire selected representation in a 200 (OK) response. That is partly because most clients are prepared to receive a 200 (OK) to complete the task (albeit less efficiently) and partly because clients might not stop making an invalid partial request until they have received a complete representation. Thus, clients cannot depend on receiving a 416 Range Not Satisfiable response even when it is most appropriate.

Source / Quote by: The 416 Range Not Satisfiable HTTP Status Code is specified by section 4.4 of RFC7233.

How to throw a 416 statuscode with PHP?

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

Test the 416 HTTP status code

In order to be able to display the HTTP status code (in this case 416 Range Not Satisfiable) 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 416 Range Not Satisfiable
Overview
URL: https://http-statuscode.com/errorCodeExample.php?code=416
Status: 416 Range Not Satisfiable
Those: Network
IP address: XX.XX.XX.XX
Status code 416 Range Not Satisfiable

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

Creating your own 416 Range Not Satisfiable 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 416 Range Not Satisfiable error page in "Apache", the following change must be made in the following file.

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

NGINX Webserver

Similar to the web server "Apache", "NGINX" is also widely used on the Internet. To create your own 416 Range Not Satisfiable error page in "NGINX", the following change must be made in the following file.

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

Browser compatibility of the 416 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

HttpStatusCode.RequestedRangeNotSatisfiable
http.StatusRequestedRangeNotSatisfiable
Response::HTTP_REQUESTED_RANGE_NOT_SATISFIABLE
httplib.REQUESTED_RANGE_NOT_SATISFIABLE
http.client.REQUESTED_RANGE_NOT_SATISFIABLE
http.HTTPStatus.REQUESTED_RANGE_NOT_SATISFIABLE
:requested_range_not_satisfiable
Author: Tony Brüser
Author: Tony Brüser

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

LinkedInGitHub