🎉 Requestly joins BrowserStack to build the future of application testing. Read more

HTTP Headers

If Range

HTTP Header

The HTTP If-Range request header allows for conditional range requests.
When the specified condition is met, a range request is initiated, and the server responds with a 206 Partial Content status, delivering a portion (or multiple portions) of the resource in the response body.
If the condition is not satisfied, the server returns the complete resource with a 200 OK status.

This header can be used either with the Last-Modified validator or with ETag to validate the resource, but both methods cannot be used simultaneously.

The primary use case for the If-Range header is to resume a download, ensuring that the resource on the server has not been modified since the last partial download was received by the client.

Syntax

http

If-Range: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT
If-Range: <etag>

The Http-Range header is used in HTTP requests to specify the range of data the client wants to retrieve from the server. It can be formatted in different ways:

Directives

etag
An entity tag uniquely representing the requested resource. It is a string of ASCII characters placed between double quotes (like "675af34563dc-tr34"). A weak entity tag (one prefixed by W/) must not be used in this header.
day-name
One of Mon, Tue, Wed, Thu, Fri, Sat, or Sun (case-sensitive).
day
Two-digit day number, for example, “04” or “23”.
month
One of Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, or Dec (case-sensitive).
year
Four-digit year number, for example, “1990” or “2016”.
hour
Two-digit hour number, for example, “09” or “23”.
minute
Two-digit minute number, for example, “04” or “59”.
second
Two-digit second number, for example, “04” or “59”.
GMT
Greenwich Mean Time. HTTP dates are always expressed in GMT, never in local time.

Example

http
If-Range: Wed, 21 Oct 2015 07:28:00 GMT
If-Range: "67ab43"

How to Modify Header using Requestly

Requestly is a powerful Chrome extension that allows you to modify HTTP headers, including the Range header. This is particularly useful for testing how your application handles partial content requests or for simulating download resumptions during development or debugging. Steps to Modify the Range Header:

  1. Install and open the Requestly Chrome extension. You can find it on the Chrome Web Store.
  2. Create a new rule: Click on “Create Rule” and choose “Modify Headers” from the list of available rule types.
  3. Add a new header modification:
    • Under “Action”, select “Add” or “Override”.
    • In the “Header Name” field, enter Range.
    • In the “Header Value” field, enter the desired byte range (e.g., bytes=0-499).
  4. Set the URL condition: Specify the URL or pattern where this header change should apply (e.g., https://your-api.com/*).
  5. Save the rule.

Once set up, Requestly will inject the Range: bytes=0-499 header into all matching requests, allowing you to simulate partial content fetching and test how your server handles range requests.