HTTP Headers
Last Modified
The HTTP Last-Modified
response header indicates the date and time when the origin server believes the resource was last altered.
It functions as a validator in conditional requests such as If-Modified-Since
or If-Unmodified-Since
to verify whether the requested resource matches the version stored by the client.
While less precise than an ETag
in determining content changes, it serves as a fallback mechanism when ETags are unavailable.
The Last-Modified
header is also utilized by web crawlers to adjust crawling frequency, by browsers in heuristic caching, and by content management systems (CMS) to display the timestamp of the last modification.
Syntax
The Last-Modified header specifies the date and time when the resource was last changed. Its syntax follows this format:
Example:
Last-Modified: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT
Directives
One of “Mon”, “Tue”, “Wed”, “Thu”, “Fri”, “Sat”, or “Sun” (case-sensitive).
2 digit day number, e.g., “04” or “23”.
One of “Jan”, “Feb”, “Mar”, “Apr”, “May”, “Jun”, “Jul”, “Aug”, “Sep”, “Oct”, “Nov”, “Dec” (case-sensitive).
4 digit year number, e.g., “1990” or “2016”.
2 digit hour number, e.g., “09” or “23”.
2 digit minute number, e.g., “04” or “59”.
2 digit second number, e.g., “04” or “59”.
Greenwich Mean Time. HTTP dates are always expressed in GMT, never in local time.
Example
Last-Modified: Wed, 21 Oct 2015 07:28:00 GMT
How to Modify Header using Requestly
Requestly is a powerful Chrome extension that allows you to modify HTTP headers, including the Last-Modified header. This is particularly helpful when you want to test how your application handles cache validation or content freshness without changing the actual server response. Steps to Modify the Last-Modified Header:
- Install and open the Requestly Chrome extension. You can find it on the Chrome Web Store.
- Create a new rule: Click on “Create Rule” and choose “Modify Headers” from the list of available rule types.
- Add a new header modification:
- Under “Action”, select “Add” or “Override”.
- In the “Header Name” field, enter Last-Modified.
- In the “Header Value” field, enter the desired date and time (e.g., Wed, 21 Oct 2015 07:28:00 GMT).
- Set the URL condition: Specify the URL or pattern where this header change should apply (e.g., https://your-api.com/*).
- Save the rule.
Once set up, Requestly will inject the Last-Modified header with your specified value into all matching requests, enabling you to test how your application reacts to different content update times. Modifying the Last-Modified header lets you simulate changes in resource freshness, helping you verify cache behavior or conditional requests in your app without needing to alter the backend server itself.
Table of Contents
- No headings found.