话题 / CDN 缓存局限性

观点转述

此前忽略非图像响应的 Vary 标头

新功能上线前,Cloudflare 会忽略图像以外响应的 Vary 标头,存在缓存错误共享的风险——例如将 JSON 响应缓存后返回给期望 HTML 的客户端。

观点背后的信息

译文仅辅助阅读;核查观点请以原始摘录为准。

评论:我们刚刚发布了对 HTTP 最“丑陋”部分的支持——Vary

这以前无法部署在 Cloudflare 缓存之后,因为他们会忽略图像以外任何内容的 Vary 标头——因此你可能会缓存 JSON 版本,然后将其提供给期望 HTML 的用户。

原始摘录
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.