定义以下配置以避免对API进行动态缓存之后:用于API的Cloudflare
我的呼叫仍然处于动态缓存状态。您可以看到接收到的响应头:
access-control-allow-methods: GET,OPTIONS
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400, h3-28=":443"; ma=86400, h3-27=":443"; ma=86400
cache-control: no-cache, no-store, max-age=0, must-revalidate
cf-cache-status: DYNAMIC
cf-ray: 698eeac5ae5640cf-CDG
client-control: max-age=43200, s-max-age=43200
content-encoding: br
content-type: application/json
date: Mon, 04 Oct 2021 13:57:03 GMT
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
expires: 0
pragma: no-cache
server: cloudflare
strict-transport-security: max-age=31536000; includeSubDomains; preload
vary: Origin,Access-Control-Request-Method,Access-Control-Request-Headers, Accept-Encoding
x-content-type-options: nosniff
x-frame-options: DENY
x-xss-protection: 1; mode=block这是我做的配置

您是否找到了获得“旁路”缓存云状态标头的方法?
发布于 2021-10-04 18:33:54
如果您的目标是避免缓存API调用,那么上面的页面规则看起来是正确的。您正在使用一个Cache Level指令来Bypass缓存逻辑。
这意味着所有匹配URL模式的调用都将从原始服务器中提取。这是由以cf-cache-status值为值的DYNAMIC响应头确认的。
来自文档
动态: Cloudflare不考虑有资格缓存的资产,Cloudflare设置没有显式指示Cloudflare缓存资产。相反,资产是从原始web服务器请求的。
响应头cf-cache-status也可以具有BYPASS值,但在其他情况下(也在文档中描述)会发生这种情况。
https://stackoverflow.com/questions/69437568
复制相似问题