If-Modified-Since
Usage
The If-Modified-Since header enables cache revalidation based on the modification date of a resource. The client includes the timestamp from the Last-Modified header received in a previous response. If the resource has not changed since the given date, the server returns a 304 Not Modified response with no body, saving bandwidth and processing time. If the resource has changed, the server sends a normal 200 response with the updated content.
The header applies only to GET and HEAD requests. For other methods, the companion If-Unmodified-Since header provides date-based conditional logic.
When both If-Modified-Since and If-None-Match appear in the same request, If-None-Match takes precedence. The ETag-based comparison is more reliable because timestamps have one-second resolution and clock skew between server and intermediate caches introduces edge cases.
The date value follows the HTTP-date format described in the Date header specification: day name, date, time in hours, minutes, and seconds, followed by GMT.
Example
A client revalidates a cached resource. The server returns 304 Not Modified if the resource has not changed since June 1, 2022 at 08:00 GMT. Otherwise, the server sends the full updated resource.
If-Modified-Since: Wed, 01 Jun 2022 08:00:00 GMT
A conditional request paired with Last-Modified in the previous response. The client stores the modification date and sends the modification date on the next request to the same resource.
Last-Modified: Wed, 01 Jun 2022 08:00:00 GMT
On the next request:
If-Modified-Since: Wed, 01 Jun 2022 08:00:00 GMT