hn.today

We just shipped support for the ugliest part of HTTP: Vary – Cloudflare Blog

blog.cloudflare.com144 points39 comments
Screenshot of We just shipped support for the ugliest part of HTTP: Vary – Cloudflare Blog

Cloudflare announced full support for the HTTP Vary header and explains why handling Vary correctly matters for caching and content correctness. Vary tells caches that responses differ based on request headers (for example, language or encoding), which makes caches store multiple variants of the same URL. The post frames Vary as one of the messiest parts of HTTP because it forces a tradeoff between correctness (serving the right variant to each client) and cache efficiency (avoiding exploding cache state), and shows how improper handling leads to broken pages, wrong languages, or incorrect compressed responses.

The write-up walks through how the new support changes caching behavior at the edge: Cloudflare now honors Vary when building cache keys so variant responses are stored and served correctly, while also providing mitigations to limit cache growth and performance impact. It includes concrete examples of common Vary uses, guidance for developers on when to use or avoid Vary, and operational advice for testing and debugging variant-related cache issues. The net effect is fewer incorrect responses for multi-variant sites and clearer configuration options for balancing cache hit rate against correctness.

Read on blog.cloudflare.com39 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Web

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.