Vary
Which request headers change the response — so caches keep separate copies per variant.
response header
Example
Vary: Accept-Encoding, Origin
- What it does
- Which request headers change the response — so caches keep separate copies per variant.
- In practice
- Forget Vary: Origin on a CORS-enabled endpoint and a CDN may serve one origin's Access-Control-Allow-Origin to a different origin — CORS that fails only sometimes, only in production, only behind the CDN. Vary: Accept-Encoding is the everyday one: compressed and uncompressed copies must not be mixed up.