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

Simon Willison's Weblog ·

A commentary by Simon Willison on Cloudflare's newly added support for the HTTP Vary header, noting his longstanding desire for it, describing prior caching limitations where Cloudflare ignored Vary for non-image responses, and stating his personal preference for URL-based content negotiation over Accept-header–based approaches. Lee 3 puntos de vista con sus evidencias y enlaces a las fuentes.

De un vistazo

  • Longstanding desire for Vary header support

    Simon Willison has wanted Cloudflare to support the HTTP Vary header for years.

    Ver el momento de apoyo · Párrafo 2
  • Cloudflare previously ignored Vary for non-image responses

    Before the new feature, Cloudflare ignored the Vary header on responses other than images, risking incorrect cache sharing—e.g., caching a JSON response and serving it to a client expecting HTML.

    Ver el momento de apoyo · Párrafo 4
  • Preference for URL-based content negotiation over Accept headers

    Simon Willison independently chose not to use Accept-header–based content negotiation, preferring predictable URLs—for example, using a '.json' suffix to serve JSON.

    Ver el momento de apoyo · Párrafo 5

Pasajes clave3

Pasajes atribuidos con contexto para verificarlos. Abra el texto original para comprobar la fuente.

API design preference

Preference for URL-based content negotiation over Accept headers

Extracto original

(Independent of the Cloudflare feature I ended up deciding never to use that pattern, because I prefer having URL that predictably returns HTML or JSON - I add a .json suffix to my apps to serve JSON instead.)
CDN caching limitations

Cloudflare previously ignored Vary for non-image responses

Extracto original

This used to be impossible to deploy behind Cloudflare caching, because they ignored the Vary header on anything other than images - so you risked caching the JSON version and then serving it up to someone who was expecting HTML.

Fuente y metodología

Estas perspectivas enlazan a sus fuentes originales. Las paráfrasis están identificadas y no son citas textuales.

Abrir transcripción o material de origen (se abre en una pestaña nueva)Reportar un problema