Skip to content
NewA calmer, faster ZeroHour

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

Simon Willison ()1
AI summary · grok-4.7Summaries by Vani AI

Cloudflare now honors HTTP Vary, avoiding HTML and JSON cache mixups.

Simon Willison commented on Cloudflare shipping support for the HTTP Vary header in its cache. He notes that content negotiation on Accept previously risked storing a JSON response and later serving it to a client that expected HTML, because Cloudflare ignored Vary except for images. He says he still prefers distinct URLs that predictably return HTML or JSON.

Key facts
  • Cloudflare caching now honors the HTTP Vary header beyond images.
  • Ignoring Vary could cache JSON and later serve it to HTML clients.
  • Willison still prefers separate URLs that always return HTML or JSON.
Analyze this story with Vani AIImpact, who is affected and what defenders should do, in a new chat

From the original article

My comment on We just shipped support for the ugliest part of HTTP: Vary — Hacker News. I've been wanting this from Cloudflare for years . The classic problem here is if you do that thing where user agents that send "accept: text/html" get HTML, while user agents that don't get JSON or some other format.

Simon Willison

simonwillison.net

Read the full article at Simon Willison

A short excerpt; the article and its images belong to the publisher. Summary, key facts and assessment above are AI-written from the article and can be wrong.