Table of Content
The If-Range HTTP request header makes a range request conditional by allowing it to be issued only if the target resource has not been modified after the time specified. This functionality enables efficient updates of cached information with a minimum amount of transaction overhead. It is particularly useful for large resources that might undergo updates during a series of GET range requests.
The If-Range header uses either an ETag or a date as a directive:
<etag>- An entity tag uniquely representing the requested resource.
<http-date>- The date compares to the Last-Modified date of the resource.
Here are examples of how to use the If-Range header:
GET /file HTTP/1.1
In this example, if the ETag hasn't changed, the server will return bytes 500-999 of the document. Otherwise, it will return the entire document.
How to modify If-Range header
ModHeader is a Chrome extension that can modify HTTP request headers. You can use ModHeader to alter the If-Range header for specific purposes.
Here's how to use it:
- Install the ModHeader extension from the Chrome web store.
- Click on the ModHeader icon in your browser toolbar to open it.
- In the 'Request Headers' section, click on 'Add'.
- Fill the 'Name' field with 'If-Range'.
- Fill the 'Value' field with your desired '<etag>' value or '<http-date>'.
- Now, all your requests will use this If-Range header.
This can be particularly useful when you are testing your website's performance and caching mechanisms, ensuring that they work optimally with the If-Range header.