# Vary -- the cache key contract

DevFeed: [Vary -- the cache key contract](<https://devfeed.tech/articles/vary-the-cache-key-contract-89145.md>)

Original publisher: [Read original article](<https://specification.website/spec/performance/vary/>)

Author: Joost de Valk

Published: 2026-09-10T00:00:00Z

Content type: tutorial

Language: en

Sources: [The Website Specification](<https://devfeed.tech/sources/the-website-specification.md>)

Topics: [Cache](<https://devfeed.tech/topics/cache.md>), [cache-invalidation](<https://devfeed.tech/topics/cache-invalidation.md>), [nginx](<https://devfeed.tech/topics/nginx.md>), [cache-control](<https://devfeed.tech/topics/cache-control.md>)

Tags: [cache](<https://devfeed.tech/tags/cache.md>), [cache-control](<https://devfeed.tech/tags/cache-control.md>), [caching](<https://devfeed.tech/tags/caching.md>), [cdn](<https://devfeed.tech/tags/cdn.md>), [curl](<https://devfeed.tech/tags/curl.md>), [https](<https://devfeed.tech/tags/https.md>), [performance](<https://devfeed.tech/tags/performance.md>), [recommended](<https://devfeed.tech/tags/recommended.md>)

## AI overview

This tutorial explains how the HTTP `Vary` response header controls which cached representation can be reused for a request. It covers content negotiation, cache fragmentation, correct header placement, and verification through a CDN.

## Source excerpt

Vary lists the request headers your server branched on when it chose this representation. Get it wrong and a cache hands one visitor's response to another; list too much and the cache stops working at all.