Cloudflare:清除单个文件不起作用(Cloudflare: purge of single files doesn't work)

编程入门 行业动态 更新时间:2024-10-28 14:21:43
Cloudflare:清除单个文件不起作用(Cloudflare: purge of single files doesn't work)

我试图清除我的网站的主页(只有主页),我没有成功。 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

任何人都知道为什么会这样? 标题中的东西?

I am trying to purge the homepage of my site (and only the homepage) and I am not succeeding. Hurl.it keeps being served a "hit". To test things further, I opened the Cloudflare interface, and added the following two lines in the "Purge individual files" field on the caching tab, which basically is a manual purge of the homepage (or so I think)

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

But still the same thing:

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

Anyone an idea why this is the case? Something in the headers?

最满意答案

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

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

Cloudflare缓存选项卡

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

尊重现有的标题Cloudflare

了解更多信息:

浏览器缓存到期TTL意味着什么? 如何缓存静态HTML?

It looks like your browser is caching the response; I note the Cache-Control header is set to a few hours. Cloudflare will, by default, override Cache-Control headers - you can however bypass this behaviour using a feature known as "Respect Existing Headers".

In order to utilise this - firstly navigate to the caching tab in the Cloudflare dashboard.

Cloudflare Caching Tab

Once here, scroll down to an option labelled "Browser Cache Expiration", simply select the "Respect Existing Headers" option here. After this is set, Cloudflare will not override Cache-Control headers (even if they don't exist at all).

Respect Existing Headers Cloudflare

For more information:

What does browser cache expire TTL mean? How do I cache static HTML?

更多推荐

本文发布于:2023-07-24 01:43:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1240052.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不起作用   文件   Cloudflare   purge   work

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!