Last-Modified Header
Table of Content
- Syntax
- Directives
- Examples
- Browser Compatibility
- How to modify Last-Modified header The Last-Modified response HTTP header provides the date and time when the origin server believes the resource was last modified before the request was made. This is used with cache validation to allow browsers to check if a cached copy of the page is up-to-date, valid and does not need to be re-fetched. This makes load times faster and reduces server load.
Syntax
The Last-Modified HTTP header uses the following syntax:
Last-Modified: day_name, day month year hrs:min:sec GMT
Directives
The Last-Modified header only contains the date directive, which determines the last time the document was modified.
Examples
For a file that was modified on 25th October 2021 at 15:30:00 GMT, the Last-Modified header would look like:
Last-Modified: Mon, 25 Oct 2021 15:30:00 GMT
Browser Compatibility
Browser | Compatibility |
---|---|
Chrome | Supported |
Firefox | Supported |
Safari | Supported |
Opera | Supported |
Edge | Supported |
How to modify Last-Modified header
ModHeader is a browser extension that allows you to modify HTTP request and response headers. To change the Last-Modified header with ModHeader in Chrome, perform the following steps:
- Click the ModHeader icon at the top right of Chrome to open its panel.
- In the
Response headers
section, clickAdd
. - In the
Header name
field, enterLast-Modified
. - In the
Header value
field, enter the time you want, such asWed, 21 Oct 2018 07:28:00 GMT
. - Click
Add
to apply your changes.
The extension inserts the header before the server responds, which is useful for testing how your app behaves when receiving different Last-Modified
values. Please be wary of using it on production environments, as it can affect the cache behavior.