Independent tech intelligence, checked against primary sources.

TechPulseMind Useful technology.
No manufactured hype.

Cloudflare Adds Vary Header Support to Cache Rules

New Cache Rules features allow granular handling of the HTTP Vary header, helping developers normalize or bypass cache for negotiated content.

Cloudflare Adds Vary Header Support to Cache Rules

Before you start: versions, package names and storage identifiers change over time. Check the commands against the official documentation for your setup before running them, especially anything that creates, deletes or overwrites data.

Understanding the HTTP Vary Challenge

Cloudflare has announced native support for the HTTP Vary response header within its Cache Rules interface, available across all account plans. Historically, the Vary header has presented significant interoperability hurdles for intermediary caches, often resulting in fragmented cache entries and reduced efficiency when multiple client preferences target the same URL.

While the Vary header instructs caches on which request fields can alter a response, it lacks mechanisms to indicate whether minor header variations actually yield different server outputs. This gap previously forced developers to choose between low cache hit rates or completely bypassing cache for negotiated content.

How Cache Rules Manage Vary Variations

The newly deployed functionality splits control between the origin server and the edge configuration. The origin continues to declare which request headers impact the response via the Vary header, while administrators use Cache Rules to determine how the network handles each specified header.

The system provides three distinct handling actions for request headers named in Vary:

  • Normalize: Standardizes headers such as Accept, Accept-Language, and Accept-Encoding, allowing equivalent requests to share cached responses while forwarding the cleaned values to the origin.
  • Passthrough: Preserves raw bytes, casing, whitespace, and ordering for scenarios where exact header values change the underlying response.
  • Bypass: Prevents caching entirely for responses that rely on high-cardinality or unpredictable headers, such as cookies or user agent strings.

For practitioners managing self-hosted applications or multi-format content delivery, this architecture provides a balance between serving accurate negotiated responses and protecting origin servers from excessive cache fragmentation.

Source

Official announcement or documentation

Some links on this page may be affiliate links. If you buy through them we may earn a commission at no extra cost to you. See our affiliate disclosure.