Open In App

HTTP headers | Accept-Ranges

Improve
Improve
Like Article
Like
Save
Share
Report

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.

Syntax:

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.

Example:

Accept-Ranges: bytes

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
  • Firefox
  • Safari
  • Opera

Last Updated : 31 Oct, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads