Skip to content
On this page

Accept-Ranges

Description

The Accept-Ranges response header is used by servers to indicate whether they support range requests for a resource. Range requests allow clients to request only specific portions of a resource, which is particularly useful for large files or resumable downloads.

When a server supports range requests, clients can use the Range request header to specify which parts of the resource they want to receive. This mechanism enables functionality like pausing and resuming downloads, or streaming specific sections of media files.

If the server does not support range requests, it typically omits this header or explicitly sets its value to none.

Syntax

The syntax of the Accept-Ranges header follows this structure:

plaintext
Accept-Ranges: <range-unit>
  • <range-unit>:
    Indicates the unit in which ranges can be specified. The most common value is bytes, but other values are possible.

Example Syntax

plaintext
Accept-Ranges: bytes

This example tells the client that the server accepts range requests specified in bytes.

plaintext
Accept-Ranges: none

This explicitly indicates that the server does not support range requests.

Examples

Basic Example

A server response indicating support for byte range requests:

plaintext
HTTP/1.1 200 OK
Date: Mon, 02 Jun 2025 10:11:12 GMT
Content-Type: video/mp4
Content-Length: 10485760
Accept-Ranges: bytes

[...file content...]

Client Using Range Requests

After receiving the above response, a client might make a range request:

plaintext
GET /video.mp4 HTTP/1.1
Host: example.com
Range: bytes=1048576-2097151

Server response to the range request:

plaintext
HTTP/1.1 206 Partial Content
Date: Mon, 02 Jun 2025 10:11:15 GMT
Content-Type: video/mp4
Content-Length: 1048576
Content-Range: bytes 1048576-2097151/10485760
Accept-Ranges: bytes

[...partial file content...]

Summary

The Accept-Ranges response header plays a crucial role in enabling efficient content delivery by indicating a server's support for range requests. This functionality is essential for applications that need to download large files, stream media content, or implement resumable downloads. When servers support range requests, clients can request specific portions of resources, reducing bandwidth usage and improving the user experience for large content transfers.

Released under the MIT License.