Cloudflare resolves the Vary header’s crippling inefficiency with a new Cache Rules solution
The Vary header remains HTTP’s most unreliable tool—like a drawer stuffed with incompatible parts, forcing developers to improvise. It’s the only way to signal that a single URL can yield multiple responses, such as WebP for one browser and JPEG for another. Without it, the first cached response dominates, turning a JSON API request into a fatal HTML page delivery.
The real breakdown happens when caches respect Vary. The header identifies which request field triggers variations, but it omits critical details: which values within that field actually alter the response. The result is a system that technically obeys standards but fails in practice.
The worst-case scenario unfolds with language headers. A site supporting English, French, and German may receive these two identical requests:
Accept-Language: en-US,en;q=0.9Accept-Language: en-GB,en;q=0.8
Both request English content, yet the server delivers the same page. A naive cache treats them as separate entries, storing redundant copies. Scale this across three headers, each with around ten possible variations, and the cache bloat explodes—thousands of identical entries cluttering storage. Add User-Agent strings or cookies, and the cache becomes a functional black hole, collapsing hit rates to zero.
Cloudflare’s new Cache Rules now lets operators reclaim control. Instead of enduring arbitrary fragmentation, you can enforce specific handling rules:
- Normalization – Merge overlapping language or preference variations into a single cache key, eliminating redundant entries.
- Strict matching – Force the cache to distinguish requests where even minor header differences justify separate responses.
- Cache bypass – Skip caching entirely for unpredictable variations, avoiding wasted resources.
The origin server still defines potential variation points, but Cache Rules let you define which variations matter. This turns an otherwise useless HTTP mechanism into a practical tool for managing dynamic content.

Using Cache Rules to handle the Vary header saves me from the manual cleanup I used to do every single week. For example, I can now specify that the
Accept-Languageheader should be ignored for caching purposes, significantly reducing the number of cache entries and improving hit rates.