If-Range

The HTTP If-Range request header is similar to the HTTP If-Match header, except that if the condition fails then the entire resource is transferred, thereby ignoring the HTTP Range request header.

Usage

The If-Range request header is included by the client to indicate that the server shall only consider the HTTP Range header if the specified condition is met. The condition can be an ETag or a Last-Modified condition, but not both.

The effect of ignoring the HTTP Range will be that the entire resource is transmitted. The consequence of an If-Match in the same circumstance will be the server returning HTTP error 412 Precondition Failed. However, HTTP If-Range will succeed after the entire resource is processed, e.g. upon returning HTTP status code 200 OK.

Example

In the first example, a Last-Modified condition is used, whereas an ETag is specified in the second example.

Request

If-Range: Wed, 01 Jun 2022 08:00:00 GMT

Request

If-Range: "1234567890"

Note

Both of these conditions cannot be specified in the same HTTP request.

Takeaway

The If-Range header is used in place of HTTP If-Match to instruct the server to process the entire resource rather than deny the HTTP request.

See also

Last updated: June 2, 2022