Vic*_*hou 6 etag http cloudflare
我有一个使用Cloudflare 的网站(例如http://example.com).没有什么特别的,没有奇怪的页面规则,没有奇怪的设置,免费的计划.
当我访问http://example.com时,我收到了GET http://example.com请求的响应:
Cache-Control:no-cache, must-revalidate
CF-RAY:2b8d0490837f2828-SJC
Connection:keep-alive
Content-Encoding:gzip
Content-Type:text/html; charset=UTF-8
Date:Sun, 26 Jun 2016 01:52:05 GMT
Expires:0
Pragma:no-cache
Server:cloudflare-nginx
Transfer-Encoding:chunked
Vary:Accept-Encoding
X-Powered-By:Express
Run Code Online (Sandbox Code Playgroud)
请注意,响应没有ETag标头,即使它在我的原始服务器上已启用.
当我直接去原始服务器时,例如GET http://01.23.456.789/,我得到了这个回复:
Accept-Ranges:bytes
Cache-Control:no-cache, must-revalidate
Connection:keep-alive
Date:Sun, 26 Jun 2016 01:56:53 GMT
ETag:W/"4cf8-1558a5557a0"
Expires:0
Pragma:no-cache
X-Powered-By:Express
Run Code Online (Sandbox Code Playgroud)
有谁知道为什么Cloudflare不会转发ETag标头?如何让Cloudflare向前推进ETag?Cloudflare 默认不缓存GET http://example.com请求,因为它是一个HTML页面.
Vic*_*hou 14
我与Cloudflare技术支持工程师交谈,他帮助解决了我的问题.对于未来可能遇到同样问题的人,以下是解决问题的方法:
我为相关的URL启用了电子邮件混淆(即删除了其ETag标头).根据https://support.cloudflare.com/hc/en-us/articles/218505467-Does-CloudFlare-support-ETag-headers- ,
Email Obfuscation will need to be disabled, otherwise the ETag headers
will be removed from the response. Email Obfuscation modifies the code
significantly enough it cannot be considered semantically equivalent.
Run Code Online (Sandbox Code Playgroud)
但是,禁用电子邮件混淆仍然无法解决问题.事实证明我启用了一个可以修改HTML的应用程序,因此必须使ETag无效.最后,为该URL设置具有禁用安全性,禁用应用程序,禁用性能的页面规则可以解决问题.