Applies to: Protocol and format interpretation for developers inspecting authorized media delivery.

The useful distinctions

  • Vary names request fields that influenced response selection.
  • Caches account for those fields when matching stored responses.
  • A consistent Vary value matters across response variants.

Turn negotiation inputs into a ledger

A URL alone may not describe every input used to choose a response. For the synthetic example, imagine two otherwise similar requests: one offers gzip and one offers only identity encoding. Write their Accept-Encoding values beside their results. The response's Vary field explains why a stored result selected for one request should not automatically answer the other. This ledger is more informative than simply saying that a URL was cached.

Keep variation narrow and intentional

Every actual selection input needs an appropriate place in the caching model, but indiscriminately listing fields makes the model harder to inspect and may fragment useful reuse. The engineering task is to identify what the server really varies, then keep that statement consistent with all corresponding responses. When a cache surprise occurs, compare both the URL and those named request fields before blaming the media format. A different content encoding can explain a different byte count while leaving the decoded playlist text unchanged. Conversely, identical header inputs do not prove a publication stayed unchanged between two collection times; retain validators and timestamps for that separate question. The ledger can name its rows gzip-offered and identity-only without inventing filenames. Both can point to the same URL while recording different selection inputs and independently observed representation metadata.

Worked example · synthetic

This is a header-only illustration, not a gzip payload sample. A cache matching this synthetic result must account for Accept-Encoding in addition to the usual target information.

Valid HTTP response-field excerpt; no encoded payload is supplied.

HTTP/MIME line endings are CRLF. Request URL context, where labelled, is commentary rather than a wire field. No message was transmitted.

Vary: Accept-Encoding
Content-Encoding: gzip

Check the interpretation

  • Compare the named request fields.
  • Keep Vary consistent across negotiated variants.
  • Do not use equal URLs as proof of equal encoded bytes.