1. HTTP (Hypertext Transfer Protocol)

  1. HTTP Headers

  1. Last-Modified
    1. Writing responses (origin servers)
    2. Reading responses (user agents)
    3. Overview table
    4. Syntax
      1. Example
    5. History

Last-Modified

The "Last-Modified" header field specifies the date when the representation was last modified: the most recent date when the representation was changed to its current contents. It can be used in caching and conditional requests.

Writing responses (origin servers)

Send a Last-Modified header if there's a reasonable way to determine the representation's modified-time. For representations read from the filesystem, this will be the mtime. If the response is generated from multiple parts, this must be computed as most recent last-modified time of the component parts, including the template that assembles them together. The Last-Modified date changes every time the document does, and never goes backwards (except invalid dates in the future). It only describes the selected representation, not necessarially other representations that could have been negotiated.

Servers must not send Last-Modified dates later than the Date header.

Reading responses (user agents)

Clients use the Last-Modified when caching documents; it may be used to compute a heuristic expiration time, and/or may be used in an If-Modified-Since or If-Unmodified-Since header. If the ETag header is present, that is used instead for freshining caches.

The Last-Modified date applies to the selected representation; if the response includes a Vary response-header, then the Last-Modified value can vary among the listed dimensions. If the response includes a Content-Location header, then the Last-Modified date also describes that resource.

Overview table

Name
Last-Modified
Description
Identifies the date when the representation was last modified
Direction
Response
Specification
RFC 9110: HTTP Semantics §8.8.2. Last-Modified

Syntax

Last-Modified = HTTP-date

Example

Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT

History

  1. 1999-06: RFC 2616 §14.29. Last-Modified
  2. 2014-06: RFC 7232 §2.2. Last-Modified
  3. 2022-06: RFC 9110 §8.8.2. Last-Modified