Skip to main content

1. Introduction

The Hypertext Transfer Protocol (HTTP) is a stateless application-level request/response protocol that uses extensible semantics and self-descriptive messages for flexible interaction with network-based hypertext information systems. HTTP is commonly used in distributed information systems where the use of response caches (Response Caches) can improve performance. This document defines aspects of HTTP related to caching and reusing response messages.

An HTTP "cache (Cache)" is a local store of response messages and the subsystem that controls the storage, retrieval, and deletion of messages within it. A cache stores cacheable responses to reduce the response time and network bandwidth consumption for future equivalent requests. Any client or server may (MAY) employ a cache, except when acting as a tunnel (Tunnel) (see Section 3.7 of [HTTP]).

A "shared cache (Shared Cache)" is a cache that stores responses for reuse by multiple users; shared caches are typically (but not always) deployed as part of an intermediary (Intermediary). In contrast, a "private cache (Private Cache)" is dedicated to a single user; typically, they are deployed as components of a user agent (User Agent).

The goal of HTTP caching is to significantly improve performance by reusing previous response messages to satisfy current requests. As defined in Section 4.2, a cache considers a stored response to be "fresh (Fresh)" if it can reuse the stored response without "validation (Validation)" (i.e., checking with the origin server to see if the cached response is still valid for this request). Thus, every time a cache reuses a fresh response, latency and network overhead can be reduced. When a cached response is not fresh, it may still be reusable if validation can freshen it (Section 4.3) or if the origin server is unavailable (Section 4.2.4).

This document obsoletes RFC 7234, with a summary of changes in Appendix B.

1.1 Requirements Notation

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.

Section 2 of [HTTP] defines conformance criteria and contains considerations regarding error handling.

1.2 Syntax Notation

This specification uses the Augmented Backus-Naur Form (ABNF) notation of [RFC5234], extended with the case-sensitivity string notation defined in [RFC7405].

It also uses the list extension defined in Section 5.6.1 of [HTTP], which allows compact definition of comma-separated lists using the "#" operator (similar to how the "*" operator indicates repetition). Appendix A shows the collected grammar with all list operators expanded to standard ABNF notation.

1.2.1 Imported Rules

The following core rules are included by reference as defined in Appendix B.1 of [RFC5234]: DIGIT (decimal 0-9).

[HTTP] defines the following rules:

HTTP-date     = `<HTTP-date, see [HTTP], Section 5.6.7>`
OWS = `<OWS, see [HTTP], Section 5.6.3>`
field-name = `<field-name, see [HTTP], Section 5.1>`
quoted-string = `<quoted-string, see [HTTP], Section 5.6.4>`
token = `<token, see [HTTP], Section 5.6.2>`

1.2.2 Delta Seconds

The delta-seconds rule specifies a non-negative integer representing time in seconds.

delta-seconds  = 1*DIGIT

A recipient parsing a delta-seconds value and converting it to binary form ought to use an arithmetic type of at least 31 bits of non-negative integer range. If a cache receives a delta-seconds value greater than the greatest integer it can represent, or if any of its subsequent calculations overflow, the cache must (MUST) treat that value as 2147483648 (2^31) or the greatest positive integer it can conveniently represent.

Note: The value 2147483648 exists for historical reasons, representing infinity (over 68 years), and need not be stored in binary form; implementations may generate it as a string even if the calculation uses an arithmetic type that cannot directly represent that number. What matters here is that overflow is detected rather than treated as a negative value in subsequent calculations.