Vary field
Vary tells recipients which request fields influenced representation selection.
- caching
- negotiation
- fields
Meaning
Vary lists request fields that influenced selection of a response. Caches use
those named values when deciding whether a stored response matches a later
request.
Vary: Accept-Encoding, Accept-Language
Expected result: a cache distinguishes stored responses using the normalized values of both named request fields. This does not make the response cacheable or define every internal cache-key component.
Wildcard
Vary: * signals that aspects beyond the available request fields influenced
selection, so a cache cannot determine a match from a later request.
Common mistake
Omitting a selection input can serve the wrong representation. Adding high-cardinality or unnecessary inputs can sharply reduce reuse. Name the fields that actually drive selection.
