HTTP status codes are numbers that represent the statuses of particular requests. These messages help identify whether a request was successful, redirected, or had an error. You’ll likely run across these codes while working on your website, including HTTP 416.
Status codes that fall into the HTTP 400 category typically indicate a bad request that could not be completed. If you run into the HTTP 416 error, don’t panic. The good news is that you can take steps to resolve it.
In this post, we’ll explain the HTTP 416 status code and some common causes of the error. Then we’ll explain how to troubleshoot and fix the issue. Let’s jump in!
Check Out Our Video Guide to Fixing the HTTP 416 Error
What the HTTP 416 Status Code Means
The HyperText Transfer Protocol (HTTP) 416 status code is also known as “Range Not Satisfiable”. This message means that the request you made can’t be fulfilled. More specifically, it indicates that your request was for a portion of a resource that the server couldn’t return.
You’ll usually see this status code because the server doesn’t have the specific resource you’re asking for. For example, if you try to access a page that doesn’t exist, you may see a 416 error.
HTTP status codes help identify whether a request was successful, redirected, or had an error. 👀 So what to do when you see HTTP 416? 😅 Read on…Click to Tweet
Common Causes of the HTTP 416 Error
There are a few different reasons that this error can happen. For instance, you’ll see HTTP 416 if the server doesn’t have the specific resource you’re asking for. Alternatively, the server could be temporarily down or unavailable.
Typically, the document or page doesn’t contain the indicated request ranges. Alternatively, the value of the range header (the part that the server should return) doesn’t make sense.
For instance, let’s say you have an image 1,000 bytes in size. If your server specifies the wrong value, such as 1,500, then the browser will send a request for 1,500 bytes from the server. Your server may return an HTTP 416 error in this scenario because the image is only 1,000 bytes.
It’s also possible that the server is configured to only serve certain types of resources. If you see the HTTP 416 error, it may mean that the resource you’re trying to access isn’t one of the server-supported types.
Finally, you might see the HTTP 417 error if you’ve made too many requests in a short period. When this happens, your Internet Protocol (IP) address may be temporarily blocked.
Troubleshooting and Locating the HTTP 416 Error
When faced with the 416 response message, you’ll likely want to determine which part of the range is unsatisfactory. This message usually will include a Content-Range that will indicate this information.
It will be marked by an asterisk symbol (*), followed by a forward slash (/). Then it will contain the current length of the resource. For example, it may look like the following:
Content-Range: bytes */12777</code.
How To Fix the HTTP 416 Error (4 Potential Solutions)
Now that we understand more about this HTTP status error and some common causes, let’s discuss how you can resolve it. Below are four potential solutions for fixing the HTTP 416 error!
1. Clear Your Browser Cache and Revisit the URL
The first thing you should do when trying to resolve the HTTP 416 error is to clear your browser cache. The process for doing this will depend on the browser you’re using.
For example, if you’re using Google Chrome, you can click on the three vertical dots in the top right-hand corner of the screen, then select More tools > Clear browsing data:
Make sure there is a checked box next to Cached images and files. Then, click on Clear data:
Once you’ve cleared your cache, refresh your browser. Then revisit the page to see whether the error message is still present. It’s also a good idea to double-check the URL you’re trying to access to ensure that it’s spelled correctly without extra spaces or characters.
2. Check the Apache Error Log
Another step you can take to resolve the HTTP 416 error is to check the error log. If you have an Apache server, you can access its log by using Secure Shell Access (SSH) and running the following command:
sudo tail -100 /etc/httpd/logs/access_log
Once you have the error log opened, you can search for 416. Finding it can help you further narrow down which page resulted in the status code. Then, you can take the troubleshooting process further from there.
3. Use an Application Performance Monitoring (APM) Tool
Furthermore, APM tools can help you locate and resolve the HTTP 416 error. These tools can monitor the performance of your website and applications to gain deeper insights and understanding of issues as they arise.
For instance, at Kinsta, we use Nginx and Kinsta APM for all of our plan tiers:
Along with DevKinsta, this APM free tool is accessible directly from your MyKinsta dashboard. It enables you to diagnose performance issues and quickly identify their sources.
4. Disable Range Requesting
At this point, if you’re still seeing the HTTP 416 error, the best solution may be to disable range requesting. This will tell browsers they can’t use the Range request header to request byte ranges from files.
To disable range requesting, you can add the following code to the top of your .htaccess file:
Header set Accept-Ranges none Request
Header unset Range
When you’re done, save your file. Then refresh your browser to reassess the webpage resulting in the HTTP 416 status error code. If this still hasn’t fixed the problem, we recommend reaching out to your hosting provider for further assistance.
If you run into the HTTP 416 error, don’t panic. 😅 The good news is that you can take steps to resolve it with a little help from this guide ✅Click to Tweet
Summary
Running into error messages when you’re trying to access a website can be incredibly frustrating. One of the HTTP status codes that you may encounter is HTTP 416. This message usually means that the request you made can’t be fulfilled, which could be due to several reasons.
As we discussed in this post, there are four potential solutions you can use to fix the HTTP 416 error:
- Clear your browser cache and try revisiting the page resulting in the error.
- Check your error logs.
- Use an Application Performance Monitoring (APM) tool.
- Disable range requesting from your .htaccess file.
Do you want to switch to web hosting that includes an APM tool for easier error detection and resolution? Check out our Kinsta hosting plans to learn more!
Have you ever encountered an HTTP 416 error? If so, then you know how frustrating it can be to try and fix the issue. It’s one of those errors that can quickly cause a website or application to malfunction. In this guide, we’ll take a look at what causes the dreaded HTTP 416 error, as well as solutions for fixing it.
What Is 416 Http Status Code?
The 416 HTTP status code is an error of Hypertext Transfer Protocol (HTTP) that occurs when a range request header is sent by the client in order to retrieve byte ranges from a file. It’s basically used as a response for requests containing Range headers, which aren’t able to be fulfilled.
Generally, if the server cannot provide bytes within the requested range, it responds with this particular status code. In addition, clients can use the 416 Status Code to indicate that they don’t want any more of the file that has already been transferred.
In other words, the 416 Status Code indicates that there is no overlap between what has been requested and what resources are available on the server – meaning that none of the requested ranges could be satisfied. As such, this error will occur if you try to download a segment or parts of a file that doesn’t exist on the server – like trying to access non-existent pages or requesting files outside your directory structure.
It should also be noted that this error message might appear even if you actually have all of the necessary data; simply because certain servers won’t process partial (or “range”) requests unless otherwise specified in their configuration settings.
Example
here is an example of an HTTP request and response where the server responds with a 416 error:
HTTP Request:
GET /example.txt HTTP/1.1
Host: example.com
Range: bytes=1000-1999
In this example, the client is requesting a file called example.txt
from the server example.com
. Additionally, the client is requesting only a specific portion of the file, specifically bytes 1000-1999. This is specified using the Range
header, which is a request header used to specify the range of data that the client wants to retrieve.
HTTP Response:
HTTP/1.1 416 Range Not Satisfiable
Content-Range: bytes */1234
In this example, the server responds with a 416 Range Not Satisfiable
error. This indicates that the range specified in the client’s request is invalid or cannot be fulfilled by the server. The server also includes a Content-Range
header in the response, which specifies the range of bytes that are available for the file. The *
symbol in the Content-Range
header indicates that the server does not have any bytes available within the range specified by the client. In this example, the file example.txt
is only 1234 bytes in size, and the client’s request for bytes 1000-1999 falls outside the range of available bytes. Therefore, the server cannot fulfill the request and responds with a 416 Range Not Satisfiable
error.
Cause Of 416 Http Status Code Error
The 416 HTTP status code error is caused when a request ranges outside the range of bytes specified by the server in its Content Range header. This can be due to several factors, including an invalid or unavailable requested range set by the client. There may also be issues with how the server interprets the request from the client side and responds accordingly.
In particular, this type of error can occur if there are inconsistencies between what was requested on the client-side and what has been allocated for that specific resource on the server-side. For example, if a client requests more than one range but only a single range is available for that certain resource, then it could trigger a 416 error as well.
Additionally, clients might experience difficulty specifying valid byte ranges because these values must coincide exactly with those allocated on the server-side; otherwise, they will result in an unfulfilled request which leads to this particular issue.
Server Side Or Client Side Issue?
When dealing with the 416 HTTP status code error, it’s important to understand whether it is a server-side or client-side issue. The distinction between these two issues lies in how the request byte ranges are handled by the content range header field. If the server receives an unset range that exceeds what can be returned by the resource requested, then this indicates that there is a server-side issue. On the other hand, if the headers are set but exceed what can be returned from the resource, then this means there is a client-side issue.
How To Fix 416 Http Status Code Error
Fixing a 416 HTTP status code error can be rather tricky depending on the cause. The first step to resolving this issue is determining whether it’s caused by a server-side or client-side problem. Once you’ve identified the source, you should then proceed with fixing the request header being unset or setting an appropriate content range and/or byte-range request.
For instance, if the connection between your browser and the web server has been interrupted due to an expired session cookie or idle timeout, resetting them will help fix this error.
However, if there are other types of requests causing this issue such as invalidating cached files from intermediate proxy servers, then you’ll need to adjust the settings accordingly in order for the site to function properly.
Additionally, some issues may require troubleshooting at the application level since they may be related to API calls that are sent using incorrect parameters.
Regardless of the underlying root cause, understanding how a 416 HTTP Status Code works along with its corresponding headers can really be beneficial when trying to identify and resolve these errors quickly.
Similar Http Status Codes To 416
When it comes to HTTP status codes, 416 is one of the most unique. It signals that a server can not fulfill the requested range specified by the client. But what other similar response codes are there? This article will discuss some related status codes and when they should be used.
The first close relative of 416 is 417 Expectation Failed. This code indicates that the expectation given in an Expect header could not be met by the server. For example, if a web page has multiple elements such as images and videos that need to load before being displayed, this error might appear in a browser console or network tab due to incorrect loading order.
Another similarly named code is 206 Partial Content which appears when only part of a resource can be sent due to request headers (e.g., Range). In comparison to 416 Requested Range Not Satisfiable which occurs when no part of a resource can be delivered because the range values don’t overlap with those available on the server, 206 suggests that at least something was received successfully but more data may still exist and needs to be requested explicitly using additional requests for specific ranges.
All HTTP status codes by categories
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.
Usage
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:
Content-Range: 100-250/75000
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.
Note
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.
Example
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.
Request
GET /documents/main HTTP/1.1
Host: www.example.re
Content-Range: bytes=1000-2000
Response
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>
Code references
.NET
HttpStatusCode.RequestedRangeNotSatisfiable
Rust
http::StatusCode::RANGE_NOT_SATISFIABLE
Rails
:requested_range_not_satisfiable
Go
http.StatusRequestedRangeNotSatisfiable
Symfony
Response::HTTP_REQUESTED_RANGE_NOT_SATISFIABLE
Python3.5+
http.HTTPStatus.REQUESTED_RANGE_NOT_SATISFIABLE
Apache HttpComponents Core
org.apache.hc.core5.http.HttpStatus.SC_REQUESTED_RANGE_NOT_SATISFIABLE
Angular
@angular/common/http/HttpStatusCode.RangeNotSatisfiable
Takeaway
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.
See also
- 200 OK
- 206 Partial Content
- RFC 7233
Last updated: August 2, 2023
Код ответа об ошибке протокола передачи гипертекста (HTTP) 416 Range Not Satisfiable
указывает на то, что сервер не может обслуживать запрошенные диапазоны. Наиболее вероятная причина заключается в том, что документ не содержит таких диапазонов или значение заголовка Range
, хотя и синтаксически правильное, не имеет смысла.
416
ответное сообщение содержит Content-Range
, указывающий на неудовлетворенный диапазон (то есть '*'
) , а затем '/'
и текущую длину ресурса. Например, Content-Range: bytes */12777
Столкнувшись с этой ошибкой,браузеры обычно либо прерывают операцию (например,загрузка будет считаться невозвратной),либо снова запрашивают весь документ.
None of the ranges in the request’s Range header field1 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 representation2.
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.
- 1 Range RFC7233 Section 3.1
- 2 Content-Range RFC7233 Section 4.2
- Source: RFC7233 Section 4.4
416 CODE REFERENCES
Rails HTTP Status Symbol :requested_range_not_satisfiable
Go HTTP Status Constant http.StatusRequestedRangeNotSatisfiable
Symfony HTTP Status Constant Response::HTTP_REQUESTED_RANGE_NOT_SATISFIABLE
Python2 HTTP Status Constant httplib.REQUESTED_RANGE_NOT_SATISFIABLE
Python3+ HTTP Status Constant http.client.REQUESTED_RANGE_NOT_SATISFIABLE
Python3.5+ HTTP Status Constant http.HTTPStatus.REQUESTED_RANGE_NOT_SATISFIABLE
.NET HttpStatusCode.RequestedRangeNotSatisfiable
Rust http::StatusCode::RANGE_NOT_SATISFIABLE
Apache HttpComponents Core org.apache.hc.core5.http.HttpStatus.SC_REQUESTED_RANGE_NOT_SATISFIABLE
Angular @angular/common/http/HttpStatusCode.RangeNotSatisfiable
416 status code example
Request:
GET /example.txt HTTP/1.1
Host: example.com
Range: bytes=10000-20000
In this example, the client is requesting a range of bytes that starts at 10,000 and ends at 20,000 for the file “example.txt”.
Response:
HTTP/1.1 416 Requested Range Not Satisfiable
Content-Range: bytes */10000
In the response, the server is indicating that the requested range of bytes is not available by returning a 416 status code. The “Content-Range” header indicates that the requested range is not satisfiable, as indicated by the “*” symbol, which means that no bytes are available for the requested range.
What causes a 416 status code?
There are several reasons why a client may receive a 416 status code, including:
- Requesting a range of bytes that’s outside the available range for a resource
- Requesting a resource that’s been deleted or modified since the last time it was accessed
- Requesting a range of bytes that overlaps with a previous range request
How to fix a 416 status code
You can fix a 416 status code with the following troubleshooting steps:
- Re-request a smaller range of bytes: If a client receives a 416 status code because it requested a range of bytes outside the available range for a resource, it can re-request a smaller range of bytes that’s within the available range.
- Verify that the requested resource is still available: If a client receives a 416 status code because it requested a resource that’s been deleted or modified, it can verify that the resource is still available and re-request it if necessary.
- Check for overlapping range requests: If a client receives a 416 status code because it requested a range of bytes that overlaps with a previous range request, it can check for overlapping range requests and adjust the request accordingly.
3 best practices for preventing 416 HTTP codes
These three best practices for a 416 status code can help you prevent them:
- Ensure that requested ranges of bytes are within the available range: To prevent a 416 status code from occurring, developers can ensure that requested ranges of bytes are within the available range for a particular resource.
- Avoid requesting resources that have been deleted: Developers can also prevent a 416 status code from occurring by avoiding requesting resources that have been deleted or modified since the last time they were accessed.
- Implement caching mechanisms: Caching can help prevent a 416 status code from occurring by reducing the number of requests made to a server and improving server performance.
Additional resources
- Learn about web development
- Learn about SEO
- Web development services from WebFX
- SEO services from WebFX
- MDN Web Docs
- W3Schools
Return to List of HTTP Statuses