Accept-Ranges Header
Table of Content
The Accept-Ranges header is a crucial HTTP header used to signify if the server supports partial requests or range requests. It allows clients (typically web browsers) to request parts of a resource instead of the entire resource in a single request. This functionality is especially useful for resuming interrupted downloads or for splitting large files into smaller chunks for concurrent downloading, enhancing overall download performance and efficiency.
Syntax
Accept-Ranges: bytes
Accept-Ranges: none
Directives
The Accept-Ranges header has two main directives:
bytes
: This indicates that the server accepts range requests and can send parts of the resource in bytes.none
: This indicates that the server does not accept any range requests.
Examples
A typical example of using the Accept-Ranges header is when a server supports byte serving:
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 123456
Or when the server does not support any range requests:
HTTP/1.1 200 OK
Accept-Ranges: none
Content-Length: 123456
Browser Compatibility
Browser | Compatibility |
---|---|
Chrome | Supported |
Firefox | Supported |
Safari | Supported |
Opera | Supported |
Edge | Supported |
How to modify Accept-Ranges header
ModHeader is a Chrome extension that allows you to customise HTTP request headers. To modify the Accept-Ranges header, you would first need to install ModHeader from the Chrome Web Store. After installing, click on the ModHeader icon on the Chrome toolbar and add a new header. Enter "Accept-Ranges" in the "Header Name" field and "bytes" or "none" in the "Header Value" field depending on the requirement. This could be exceptionally useful when testing how a client handles range requests or when debugging issues related to partial content delivery.