Content-Range

The HTTP Content-Range header is used when partial messages are being transmitted, and it indicates where within the full message’s body the content belongs.

Usage

When a message is split into chunks, each is referred to as a range. The Content-Range header is sent by the server to indicate where, within the full message’s body, the current message’s content belongs. The directives are unit, range-start, range-end, and size.

The unit directive is usually bytes. The range-start and range-end directives correspond to the zero-based start and end indexes of the data within the full message. The size refers to the total length of the document, although an asterisk * may be used if the size is unknown. A streaming document, for example, will have an unknown size.

Example

In these examples, the range indicated is from bytes 1000 through 2000, inclusive. In the first example, the size is indicated as 65000, whereas in the second example, the size is unknown.

Response

Content-Range: bytes 1000-2000/65000
Content-Range: bytes 1000-2000/*

Takeaway

The Content-Range header indicates the bytes range that the current message represents within the entirety of the main resource.

See also

Last updated: June 2, 2022