Skip to content

Disable Homepage Cache #38

@MrCoder

Description

@MrCoder

昨天我们注意到Ruixing的机器上缓存了首页,以至于他获得首页上的CSS并不存在。清空Cloudflare缓存之后,问题消失。

这张卡用于跟踪该问题的解决:

  1. 确认Cloudflare是否缓存了首页HTML资源;
  2. 理解为何其他人的机器上都没有出现该问题,或者重现该问题;
  3. 修改CF的缓存规则(该修改应当计入release日志)

Homepage Response Headers

CF的Response里面有两个有关Cache的Header:

Cache-Control: public, max-age=0, must-revalidate
Cf-Cache-Status: BYPASS

从这两个Header看,CF的缓存规则并没有缓存首页。

  • Cache-Control: public, max-age=0, must-revalidate: This header suggests that while the resource is public and can be cached, it should not be stored for any duration (max-age=0) and must be revalidated with the origin server before being served.
  • Cf-Cache-Status: BYPASS: This indicates that Cloudflare did not serve this resource from its cache and bypassed the cache for this request.
Full Response Header List
Access-Control-Allow-Origin: *
Cache-Control: public, max-age=0, must-revalidate
Cf-Apo-Via: origin,cookie
Cf-Cache-Status: BYPASS
Cf-Ray: 82bd07bd9efdaad1-SYD
Content-Encoding: br
Content-Type: text/html; charset=utf-8
Date: Sat, 25 Nov 2023 21:36:58 GMT
Nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
Referrer-Policy: strict-origin-when-cross-origin
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=CEZPkqO54uSlv3HFBs8aJ5%2BzWWOiIYanzy%2B7AwHDbYfm0vw15G6kpL%2FhWbMyZlSCAOw2MeB81bjbY4IwDr6PGYG8yegB27tDvlvwjuERG5wd58EMaGqmBR6jI%2F7F"}],"group":"cf-nel","max_age":604800}
Server: cloudflare
Strict-Transport-Security: max-age=15552000; includeSubDomains
Vary: Accept-Encoding
X-Content-Type-Options: nosniff

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions