416 Range Not Satisfiable
HTTP response status code 416 Range Not Satisfiable is a client error that is returned by the server to indicate that the range or ranges specified by the client were not retrievable. None of them overlap with the available data and hence, does not make sense, given the nature of the resource.
When the 416 Range Not Satisfiable error message is received, it implies the client has requested partial content, using the Content-Range header. For ranges of bytes, if the first byte of the specified range was greater than the length of the sequence, then this error message will be returned.
One of the reasons that partial ranges are requested is large file transfers, where the client wants to download a file in chunks. Using Content-Range in the request header, a file can effectively be downloaded in pieces and any order.
When the server can satisfy the request and return at least one of the requested ranges as a subset of the resource, it will return 206 Partial Content to indicate success. Servers have the option to ignore range requests and in turn, may return the resource in its entirety and the 200 OK status along with it.
As part of the response, the server will create a Content-Range header, which specifies the current length of the data. This will be in the form of:
This line specifies that bytes 100 through 250, for 150 bytes in total, have been returned, and the total size of the resource is 75,000 bytes.
If there is an asterisk
‘*’ before the delimiter
‘/’ then it indicates an unsatisfiable range.
Search engines like Google will not index a URL with 416 Range Not Satisfiable response status, and consequently, URLs that have been indexed in the past but are now returning this HTTP status code will be removed from the search results.
In the example, the client requests bytes 1000 through 2000 of a resource. However, the server cannot satisfy this because the file is only 512 bytes long. As such, the 416 Range Not Satisfiable error message is returned. Using the information returned from the server about the total size of the resource, the client has the option to recreate and resend the request with a valid range.
GET /documents/main HTTP/1.1 Host: www.example.ai Content-Range: bytes=1000-2000
HTTP/1.1 416 Range Not Satisfiable Content-Range: bytes */512
Alternative response – Server chooses to ignore range
HTTP/1.1 200 OK Content-Type: text/plain Content-Length: 512 <entire 512 bytes in message body>
Apache HttpComponents Core
The 416 Range Not Satisfiable status code is a client error that will be returned if the partial Range Request sent by the client does not make sense for the given resource. The server has the option to ignore HTTP range requests and send the entire resource.