我试图清除我的网站的主页(只有主页),我没有成功。 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-EncodingAnyone an idea why this is the case? Something in the headers?
最满意答案
看起来您的浏览器正在缓存响应; 我注意到Cache-Control标头设置为几个小时。 默认情况下,Cloudflare将覆盖Cache-Control标头 - 但您可以使用称为“尊重现有标头”的功能绕过此行为。
为了利用这一点 - 首先导航到Cloudflare仪表板中的缓存选项卡。
在此处,向下滚动到标有“浏览器缓存过期”的选项,只需在此处选择“尊重现有标题”选项。 设置完成后,Cloudflare将不会覆盖Cache-Control标头(即使它们根本不存在)。
了解更多信息:
浏览器缓存到期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.
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).
For more information:
What does browser cache expire TTL mean? How do I cache static HTML?更多推荐
发布评论