Table of Content
The If-Modified-Since header is an HTTP header that is sent from a client to a server, asking if a newer version of a specific resource is available. If the requested resource has not been modified since the specified time in the If-Modified-Since header, the server returns a 304 Not Modified status, instead of the requested resource, saving bandwidth.
The standard syntax for the If-Modified-Since header follows the RFC 2616 specification:
If-Modified-Since: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT
There are no specific directives associated with the If-Modified-Since header itself, rather it requires a date/time value structured in accordance with the RFC 1123 standard.
Here's a sample usage of the If-Modified-Since header:
GET /page.html HTTP/1.1 Host: www.example.com If-Modified-Since: Sun, 06 Nov 1994 08:49:37 GMT
While practically all modern web browsers support HTTP caching with the If-Modified-Since header, not all caching proxy servers are guaranteed to act upon it.
How to modify If-Modified-Since header
ModHeader is a Chrome extension that lets you manipulate HTTP request headers.
To adjust the If-Modified-Since header:
- Install the ModHeader extension from the Chrome Web Store.
- Click on the ModHeader icon in the tool bar to open it.
- Click on the '+add' button to add a new profile.
- Name it and then in the 'Request headers' section, add 'If-Modified-Since' as the header name and the corresponding date/time value in the header value field.
Modifying the If-Modified-Since header with ModHeader can be useful for testing and developing purposes – you can simulate situations where a user returns to a page after a given elapsed time. Forcing a certain date could make the server return a 304 status, which the client will then respond to by using its local, cached copy of the resource.