簡體   English   中英

無法繞過 Cloudflare 中 API 的動態狀態緩存

[英]Cannot bypass Dynamic status cache for my APIs in Cloudflare

在定義以下配置以避免 API 的動態緩存之后: Cloudflare for your API

我的調用仍處於動態緩存狀態。 您可以看到收到的響應標頭:

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

這是我完成的配置

在此處輸入圖像描述

你有沒有找到一種方法來獲得“BYPASS”緩存Clouflare Status Headers

如果您的目標是避免緩存 API 調用,那么上面的頁面規則看起來是正確的。 您正在使用Cache Level指令來Bypass緩存邏輯。

這意味着所有與 URL 模式匹配的調用都將始終從您的源服務器中提取。 這由使用DYNAMIC賦值的cf-cache-status響應 header 確認

文檔

動態:Cloudflare 認為資產不符合緩存條件,並且您的 Cloudflare 設置未明確指示 Cloudflare 緩存資產。 相反,資產是從原始 web 服務器請求的。

響應 header cf-cache-status也可以有BYPASS的值,但這發生在其他場景中(也在文檔中描述)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM