Skip to content
ADP
API Design PrincipleBETA

[ADP-134] Last-Modified

Overview

The Last-Modified header is an important HTTP response header that indicates the date and time at which the origin server believes the resource was last modified.

Purpose

The main purposes of the Last-Modified header are:

  1. To enable caching mechanisms in browsers and proxy servers.
  2. To support conditional requests, allowing clients to check if a resource has been modified since their last retrieval.

Guidance

  • Servers MUST include the Last-Modified header for cacheable resources whenever possible.
  • The Last-Modified date SHOULD be as accurate as possible.
  • If the last modification time cannot be determined, servers SHOULD NOT send a Last-Modified header.
  • Clients SHOULD use the If-Modified-Since header in conjunction with Last-Modified for efficient caching.
  • For frequently changing resources, consider using the ETag header as an alternative or supplement.
  • For dynamically generated content, use Last-Modified cautiously, ensuring its accuracy.

Usage

Server Response

When responding to a GET or HEAD request, a server should include the Last-Modified header if it can determine the last modification time of the requested resource.

Example:

http
HTTP/1.1 200 OK
Content-Type: text/html
Last-Modified: Wed, 21 Oct 2023 07:28:00 GMT

Client Request

Clients can use the If-Modified-Since header in subsequent requests to check if the resource has been modified since their last retrieval.

Example:

http
GET /example.html HTTP/1.1
Host: www.example.com
If-Modified-Since: Wed, 21 Oct 2023 07:28:00 GMT
  • ETag: Provides a more precise mechanism for validating cached resources.
  • If-Modified-Since: Used in client requests to conditionally retrieve resources.
  • Cache-Control: Specifies directives for caching mechanisms in both requests and responses.

References