If Modified Since
The HTTP If-Modified-Since request header makes a request conditional.
The server responds with the requested resource and a 200 status only if the resource has been modified after the date specified in the If-Modified-Since header.
If the resource has not been modified since then, the server returns a 304 status without any body, and the Last-Modified response header of the previous request contains the date of the last modification.
Note: The Last-Modified header helps clients determine if the resource has changed since their last fetch.
Unlike If-Unmodified-Since, the If-Modified-Since header can only be used with GET or HEAD requests.
When combined with If-None-Match, it is ignored unless the server does not support If-None-Match.
This header is mainly used to update cached entities that do not have an associated ETag header, reducing unnecessary data transfer when content hasn’t changed.
Note: The If-Modified-Since header is invaluable for efficient caching strategies, helping to minimize bandwidth by ensuring clients only download data when it has changed.
The most common use case is updating a cached copy of a resource that lacks an ETag.
Syntax
If-Modified-Since: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT
Directives
<day-name>
Specify the day of the week using a case-sensitive string: “Mon”, “Tue”, “Wed”, “Thu”, “Fri”, “Sat”, or “Sun”.
<day>
Use a two-digit number to denote the day of the month, such as “04” or “23”.
<month>
Specify the month by its abbreviation with case sensitivity: “Jan”, “Feb”, “Mar”, “Apr”, “May”, “Jun”, “Jul”, “Aug”, “Sep”, “Oct”, “Nov”, or “Dec”.
<year>
Use a four-digit year number, such as “1990” or “2016”.
<hour>
Specify the hour with a two-digit number in 24-hour format, e.g., “09” or “23”.
<minute>
Use a two-digit number to indicate minutes, such as “04” or “59”.
<second>
Use a two-digit number to represent seconds, such as “04” or “59”.
GMT
Greenwich Mean Time. HTTP dates are always expressed in GMT and never in local time.
Examples
If-Modified-Since: 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 If-Modified-Since header. This is especially helpful for testing how your application handles caching and conditional requests during development or debugging. Steps to Modify the If-Modified-Since 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 If-Modified-Since.
- 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 specified If-Modified-Since header into all matching requests, allowing you to test how your server responds to conditional GET requests and validate cache behavior.
Set headers visually: intercept and modify HTTP headers without touching your code using Requestly.
Download Free →