If-Modified-Since
Request header Conditional

Overview

If-Modified-Since is a conditional request header where the client sends the last-modified time of its cached copy, asking the server to return the body only if the resource changed after that time. It provides date-based cache revalidation.

Details

The server reports a resource's last change time via the `Last-Modified` header in a prior response. On a re-request the client puts that value in If-Modified-Since, and the server checks whether the resource changed after that time. If not, it returns 304 Not Modified with no body; if so, 200 OK with a fresh body. It is meaningful only on GET and HEAD.

The value must be an RFC 7231 HTTP date (`Wed, 21 Oct 2015 07:28:00 GMT`), always in GMT/UTC. This scheme has one-second resolution, so it can miss a change to a resource that mutates twice within the same second. That's why a more precise ETag (`If-None-Match`), when present, takes precedence.

Dynamically generated resources may lack a reliable Last-Modified, making this check inaccurate. In such cases an ETag derived from a content hash is more robust.

Syntax

If-Modified-Since: <http-date>

e.g. If-Modified-Since: Wed, 21 Oct 2015 07:28:00 GMT

Notes

Related headers

Related status codes

Specification