【问题标题】:Cloudflare does not cache static assets with proper headersCloudflare 不会缓存具有正确标头的静态资产
【发布时间】:2018-04-03 19:10:57
【问题描述】:

我读过 cloudflare 缓存 js 和 css 文件的文档。 (https://support.cloudflare.com/hc/en-us/articles/200172516-Which-file-extensions-does-Cloudflare-cache-for-static-content-)

但在我的例子中,头文件 cf-cache-status 的值是 MISS。

一个例子是这样的 css 资源:

https://example.com/style.a574b.css

带有以下响应标头:

cache-control: public, max-age=31536000
cf-cache-status: MISS
cf-ray: 405badb4ec2297bc-FRA
content-encoding: br
content-type: text/css
date: Tue, 03 Apr 2018 12:53:31 GMT
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
expires: Wed, 03 Apr 2019 12:53:31 GMT
last-modified: Tue, 03 Apr 2018 01:14:20 GMT
pragma: 
server: cloudflare
status: 200
vary: Accept-Encoding
via: 1.1 vegur
x-application-context: ourder:prod,heroku:3829
x-content-type-options: nosniff
x-xss-protection: 1; mode=block

原始响应(中间没有cloudflare是:)

 Accept-Ranges: bytes
 Cache-Control: max-age=31536000, public
 Content-Encoding: gzip
 Content-Length: 948
 Content-Type: text/css
 Date: Tue, 03 Apr 2018 19:17:46 GMT
 Expires: 
 Last-Modified: Tue, 03 Apr 2018 13:19:21 GMT
 Pragma: 
 Server: Cowboy
 Via: 1.1 vegur
 X-Application-Context: ourder:prod,heroku:20249
 X-Content-Type-Options: nosniff
 X-Xss-Protection: 1; mode=block

【问题讨论】:

标签: cloudflare


【解决方案1】:

借助 Cloudflare 支持帮助,我能够解决问题。空的 Expires Header 会导致问题。

查看此票以了解更多详情: https://support.cloudflare.com/hc/en-us/requests/1508118?page=1

【讨论】:

  • 我们看不到您的私人门票!感谢您的更新
最近更新 更多