Cloudflare已在其Cache Rules缓存规则系统中推出了对HTTP Vary响应头的完整支持功能1。Vary是HTTP标准头部,用于告知缓存系统哪些请求字段可能影响响应内容1。新功能现已面向所有付费计划用户开放1。
该功能提供三种策略来处理Vary命名的请求头1。Normalize(标准化)策略对值进行小写化、按质量值排序并剥离参数等处理1;Passthrough(透传)策略保持原样转发;Bypass(绕过缓存)策略在缓存时跳过该条目1。当响应包含Vary: *时,系统始终绕过缓存1。
Cloudflare的分析表明这一功能具有现实应用价值1。近50,000个热门网站中有近3,000个在四个或更多字段上进行变化,其中部分网站在10、23甚至47个字段上存在变化1。用户可通过Cloudflare控制面板、Rulesets API和Terraform配置来使用该功能1。
Cloudflare has rolled out comprehensive support for the Vary response header within its Cache Rules system, now available across all paid plans 1. The Vary header, a standard HTTP mechanism that signals to caches which request fields may influence response content, has long presented efficiency challenges for caching infrastructure.
To balance correctness with caching performance, Cloudflare introduced three strategies for handling request headers identified by Vary: normalize, passthrough, and bypass 1. The normalize operation standardizes header values through lowercasing, quality value sorting, and parameter stripping 1. When a response contains Vary: *, caches are always bypassed 1. Users can configure these strategies via Cloudflare's control panel, Rulesets API, and Terraform 1.
Analysis by Cloudflare revealed significant real-world usage patterns: among nearly 50,000 popular websites, approximately 3,000 apply Vary constraints across four or more fields, with some sites varying on as many as 10, 23, or even 47 fields 1.
评论
还没有评论,欢迎留下第一条。