Store and select a response
01A cache first decides whether storage is permitted, then whether a stored response matches a later request.
A JSON-preferring request must not accidentally receive a variant selected for HTML.
Key idea: A stored answer still needs a valid reuse decision.
Rules & examples
A stored answer still needs a valid reuse decision.
- Storage requires the understood method and applicable status, directive, and authentication conditions in §3.
- The primary cache key includes method and target URI; common GET caches often key primarily by URI.
- Vary requires comparing the nominated request fields before selecting a stored variant. Vary: * never matches without validation.
A cache can decline to store an otherwise cacheable response. Partial and authenticated responses have additional rules. The diagram shows an eligible ordinary GET response.
Sources
New to this? Start hereA quick picture + helpful background
A request starts a conversation.
A client asks for a resource. A server sends a response. The method, address, headers, and status explain what that conversation means.
Helpful first, if these ideas are unfamiliar
These pictures are analogies to help you learn. The linked RFC explains the actual rules.
Related RFCs and changes
“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.