Cloudflare Tames HTTP's Ugliest Header: Vary
Alps Wang
Sep 23, 2026 · 1 views
Unpacking Cloudflare's Vary Control
The core innovation of Cloudflare's Vary support lies in its granular control over how intermediary caches handle the Vary header. Historically, caches either strictly adhered to Vary and suffered from cache fragmentation due to subtle request differences, or ignored it and risked serving incorrect content. Cloudflare's introduction of normalize, passthrough, and bypass actions allows developers to strike a crucial balance. The normalize action, in particular, is a game-changer for headers like Accept-Language, where numerous client preferences map to a limited set of origin responses. By intelligently standardizing these values (e.g., downcasing, sorting by quality, stripping parameters), Cloudflare can significantly improve cache hit ratios for negotiated content, preventing the 'perfectly correct and almost permanently cold' cache scenario described in the blog. This feature directly tackles a well-known pain point in HTTP caching, offering a sophisticated yet accessible solution within the Cache Rules framework.
Key Points
- Cloudflare now supports the
VaryHTTP response header in Cache Rules across all plans. - The feature introduces three granular actions:
normalize,passthrough, andbypass, to control how caches handle request headers specified inVary. normalizeis designed to improve cache efficiency for negotiated content (e.g.,Accept-Language) by standardizing request header values, mapping many client preferences to fewer cache keys.passthroughpreserves exact request header values for cache matching, useful when subtle differences matter.bypassprevents caching for requests where a specified header might lead to highly personalized or unpredictable responses.- This addresses the long-standing problem of cache fragmentation caused by
Varywhile still ensuring correct content delivery. - The origin server must consistently return the appropriate
Varyheader for cacheable, varying responses.

📖 Source: We just shipped support for the ugliest part of HTTP: Vary
Related Articles
Comments (0)
No comments yet. Be the first to comment!
