If-Modified-Since
The HTTP If-Modified-Since request header makes the request conditional, asking the server to return the resource only if modified after the specified date and time.
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.
Note
Googlebot sends If-Modified-Since on crawl
requests with the timestamp of the last content
crawl. Servers returning 304 for unchanged
content save processing time and resources,
indirectly improving crawl efficiency. Servers
are also free to return 304 proactively for
any Googlebot request when content has not
changed, regardless of whether the request
includes conditional headers. Setting the
max-age field of the
Cache-Control response header
to the expected number of seconds the content
remains unchanged helps crawlers determine when
to recrawl a URL.
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
Takeaway
The If-Modified-Since header makes GET and HEAD requests conditional on the resource's modification date, enabling efficient cache revalidation through 304 responses when content has not changed.
Note
For SEO and caching assistance, contact ex-Google SEO consultants Search Brothers.
See also
- RFC 9110: HTTP Semantics, Section 13.1.3
- RFC 9111: HTTP Caching
- Google: HTTP caching for crawlers
- Google Search Blog: Crawling December, HTTP caching
- If-None-Match
- If-Unmodified-Since
- Last-Modified
- ETag
- 304
- Conditional-Requests
- Caching
- HTTP headers