有人知道如何redditpipe理绕过cloudflare静态HTMLcaching一旦用户login成功与页面的重新加载?
我看到当前页面在成功login后重新加载。
login前的响应标题:
CF-Cache-Status: HIT CF-RAY: 23b76b8270950e30-MXP Cache-Control: max-age=0, must-revalidate Content-Encoding: gzip Content-Length: 20794 Content-Type: text/html; charset=UTF-8 Date: Mon, 26 Oct 2015 16:08:27 GMT Server: cloudflare-nginx Vary: Accept-Encoding X-Firefox-Spdy: 3.1 X-Frame-Options: SAMEORIGIN strict-transport-security: max-age=15552000; includeSubDomains; preload x-content-type-options: nosniff x-moose: majestic x-ua-compatible: IE=edge x-xss-protection: 1; mode=block
login后的响应标题:
CF-RAY: 23b76cb065140e30-MXP Cache-Control: private, s-maxage=0, max-age=0, must-revalidate, max-age=0, must-revalidate Content-Encoding: gzip Content-Length: 18697 Content-Type: text/html; charset=UTF-8 Date: Mon, 26 Oct 2015 16:09:16 GMT Expires: -1 Server: cloudflare-nginx Vary: accept-encoding X-Firefox-Spdy: 3.1 X-Frame-Options: SAMEORIGIN strict-transport-security: max-age=15552000; includeSubDomains; preload x-content-type-options: nosniff x-moose: majestic x-ua-compatible: IE=edge x-xss-protection: 1; mode=block
感谢任何提示。
使用CloudFlare有两个关键的方法:
CloudFlare的帮助中心解释了如何通过从源发送的头来控制caching :
第二种改变CloudFlarecaching的方法是通过caching从原点发送的头文件。 CloudFlare将尊重这些设置(但仅适用于默认情况下caching的扩展名的文件),除非Page规则设置为caching所有内容并且边缘caching过期TTL已设置。 这里是我们考虑的caching标题:
- 如果Cache-Control头设置为“private”,“no-store”,“no-cache”或“max-age = 0”,或者响应中有cookie,则CloudFlare不会caching资源。
- 否则,如果Cache-Control头部设置为“public”,并且“max-age”大于0,或者将来任何时候设置Expires头部,我们将caching资源。
注意:根据RFC规则,“Cache-Control:max-age”胜过“Expires”标题。 如果我们看到两者都不同意,max-age就会赢。
在PHP中,您可以使用标头函数来实现这一点,如下所示:
header("Cache-Control: no-cache, must-revalidate");