1. HTTP (Hypertext Transfer Protocol)

  1. HTTP Headers

  1. Cache-Control
    1. Writing requests (clients)
    2. Reading requests (servers)
    3. Writing responses (servers)
    4. Reading responses (clients)
    5. Overview table
    6. Syntax
      1. Example
    7. History

Cache-Control

The Cache-Control header provides directives that modify the default caching behavior for resources; allowing a normally non-cachable resource to be cached, or restricting or prohibiting caching of otherwise cachable resources (e.g. for privacy reasons).

Writing requests (clients)

The value of the Cache-Control request header is a list of cache directives, which is a token, and an optional argument. Request Cache-Control directives typically instruct the cache to make privacy considerations or to force a refresh. RFC 7234 lists the available request Cache-Control directives.

Cache-Control was introduced in HTTP/1.1, and might not be implemented by old HTTP caches, or caches that refuse to honor the Cache-Control header.

Reading requests (servers)

For the conditions when a cache may serve a cached response, see Caching.

Writing responses (servers)

RFC 7234 lists the available response Cache-Control directives

Cache-Control was introduced in HTTP/1.1, and might not be implemented by old HTTP caches, or caches that refuse to honor the Cache-Control header.

Reading responses (clients)

For the conditions when a cache may serve a cached response, see Caching.

Overview table

Name
Cache-Control
Direction
Both
Specification
RFC 9111: HTTP Caching §5.2. Cache-Control

Cache-Control is found in both directions, however the usage in either direction is different because of the different semantics of requests and responses.

Syntax

Cache-Control = delta-seconds

Example

Cache-Control: 3550

Here, the resource was returned from a cache, and the entry was populated just under an hour ago (just under 3600 seconds).

History

  1. 1999-06: RFC 2616 §14.9. Cache-Control
  2. 2014-06: RFC 7234 §5.2. Cache-Control
  3. 2022-06: RFC 9111 §5.2. Cache-Control