Cloudflare now supports the HTTP Vary header in Cache Rules on every plan. Sites can cache multiple responses for one URL without mixing up HTML, JSON, languages or image formats.
The short answer
| Question | Answer |
|---|---|
| What does Vary do? | It identifies request headers that may change the returned representation. |
| Why is it difficult? | Raw values can create thousands of nearly identical variants. |
| Which choices does Cloudflare offer? | Normalise, preserve the exact value or bypass caching for each header. |
One URL can have several correct responses
A server may return HTML to a browser and JSON to an API, or choose AVIF instead of JPEG based on Accept. Without Vary, the first stored response may be served to the wrong client. The cache therefore needs selected request headers in its decision.
Correctness can destroy cache efficiency
Comparing every raw value preserves correctness but fragments entries quickly. Two different Accept-Language strings can both prefer French. With several high-cardinality headers, a technically correct cache stays cold and sends most traffic back to the origin.
Rules add application meaning
The origin still declares headers that may affect a response. Cloudflare can then normalise values that collapse into known groups, preserve exact values where every difference matters or bypass caching when variation is too unpredictable.
Deploy with metrics
Start with one route and a controlled dimension such as image format. Monitor hit ratio, variant count, bandwidth and content-type errors. Avoid complete cookies or User-Agent strings until an explicit normalisation strategy is in place.




Join the discussion
Comments
Loading comments…