【问题标题】:Cloudflare: purge of single files doesn't workCloudflare:清除单个文件不起作用
【发布时间】:2017-01-24 20:19:37
【问题描述】:

我正在尝试清除我网站的主页(并且只清除主页),但没有成功。 Hurl.it 一直受到“打击”。为了进一步测试,我打开了 Cloudflare 界面,并在缓存选项卡的“清除单个文件”字段中添加了以下两行,这基本上是对主页的手动清除(或者我认为)

https://example.com/ https://example.com

但还是一样:

Cache-Control: public, max-age=86400
Cf-Cache-Status: HIT
Cf-Ray: 3222f7c328d90862-IAD
Connection: keep-alive
Content-Encoding: gzip
Content-Type: text/html; charset=utf-8
Date: Mon, 16 Jan 2017 16:33:12 GMT
Expires: Tue, 17 Jan 2017 16:33:12 GMT
Last-Modified: Mon, 16 Jan 2017 16:11:40 GMT
Pragma:
Server: cloudflare-nginx
Set-Cookie: __cfduid=d936c80f83c1f69774f457a1f85937d141484584392; expires=Tue, 16-Jan-18 16:33:12 GMT; path=/; domain=.example.com; HttpOnly
Transfer-Encoding: chunked
Vary: Accept-Encoding

有人知道为什么会这样吗?标题中的内容?

【问题讨论】:

  • 默认情况下 CloudFlare 不缓存 html。您是否设置了自定义规则?
  • 是的,我有。虽然我现在正在调查可能是 Chrome 惹恼我的问题......
  • 您的网络服务器在运行什么?阿帕奇? nginx?什么版本?似乎 Pragma Header 不见了。

标签: http-headers cloudflare


【解决方案1】:

您的浏览器似乎正在缓存响应;我注意到 Cache-Control 标头设置为几个小时。默认情况下,Cloudflare 将覆盖 Cache-Control 标头 - 但是您可以使用称为“尊重现有标头”的功能绕过此行为。

为了利用它 - 首先导航到 Cloudflare 仪表板中的缓存选项卡。

在此处,向下滚动到标有“浏览器缓存过期”的选项,只需在此处选择“尊重现有标头”选项。设置后,Cloudflare 将不会覆盖 Cache-Control 标头(即使它们根本不存在)。

更多信息:

【讨论】:

  • 不错!我已经注意到它是浏览器缓存。将尝试您的解决方案。
猜你喜欢
  • 2021-11-02
  • 1970-01-01
  • 2016-05-20
  • 2013-01-17
  • 2018-07-03
  • 2015-11-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多