We just shipped support for the ugliest part of HTTP: Vary – Cloudflare Blog
The Vary header in HTTP has been widely criticized as the "ugliest part of HTTP" due to its problematic interoperability and the complexity it adds to caching. However, it is not entirely useless - it serves a crucial purpose in ensuring that caches serve the correct response for a given request. When a server returns the Vary header, it lists the request fields that may influence the response.
This allows caches to determine which request headers should be considered when serving the cached response. The origin site declares which request fields may vary, and the cache owner decides how to handle each one. The new Vary support in Cloudflare's Cache Rules allows customers to normalize known negotiation headers, pass exact values when necessary, or bypass the cache when the variation is too unpredictable.
This feature helps to strike a balance between cache efficiency and serving the correct response without overwhelming the application with additional code.
Written by urgent.news from Hacker News's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.