Skip to main content

If-Range

RequestActive

The If-Range header makes a Range request conditional. If the resource hasn't changed (ETag matches or Last-Modified date holds), the server returns the requested range as 206 Partial Content. If the resource has changed, the server returns 200 with the full resource instead of 206 with a stale range. This prevents assembling a file from mismatched chunks.

If-Range: "<etag>" | <http-date>

Description

If-Range solves the resumable download edge case: the client has partial data from a previous download and wants to fetch the rest, but if the file was updated, the partial data is useless. If-Range says 'give me bytes X-Y if the resource is still this version; otherwise give me the whole thing'. The value can be an ETag or an HTTP date.

Examples

Conditional range request
http
GET /download/file.zip HTTP/1.1
Range: bytes=1048576-
If-Range: "33a64df5"

# If ETag matches: 206 Partial Content with bytes
# If ETag changed: 200 OK with full file

Related

Specification

RFC 9110If-Range specification →