The HTTP Accept-Ranges is the Response type header also the part of the ranges system. This header act as a marker that is used by the server to supports the partial request of the clients. The HTTP Accept-Ranges is useful when the client requests any particular portion of a huge file then this header will response and allow the client to download that particular part of that huge file. Like if your server containing a 10M file and the client is demanding for the last 100 bytes of that file then it can request the server only send data from the offset in that ranges.
The Accept-Ranges applies to some particular resources different range types for another type of resource. There is one good thing in the Accept-Ranges that is client can request any byte-range without checking the server supports ranges. When the client requests the range in response, the server sends the status code 206 which is partial content if it is sending the ranges of that file or the status code 200 if it is sending the whole file.
Accept-Ranges: bytes | none
Directives: This header accepts two directives as mentioned above and described below:
- bytes: This directive defines the unit of range which is bytes. You can request byte ranges.
- None: It means no range unit is supported. This directive should not be used. This directive will remove the pause button in the download manager.
Note: The None directive is used in Internet Explorer.
To check this Accept-Ranges in action go to Inspect Element -> Network check the response header for Accept-Ranges like below, Accept-Ranges is highlighted you can see.
Supported Browsers: The browsers compatible with HTTP header Accept-Ranges are listed below:
- Google Chrome
- Internet Explorer
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.