所有
我知道这个问题已被回答了数十万次,但我遇到了一些我认为已经解决的问题。我有一个localhost测试站点(gae)它运行正常,除了页面被缓存,即使我已经显式设置python头不缓存。
self.response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate, pre-check=0, post-check=0"
self.response.headers["Expires"] = "Thu, 01 Dec 1994 16:00:00"
self.response.headers["last-modified"] = "Thu, 01 Dec 2000 16:00:00"
self.response.headers['Cache-Control'] = 'private, max-age=0'
self.response.headers["Pragma"] = "no-cache"
我通过各种方式调用Handler,例如:window.location.href =“/ test-page”,一切都很好用,这里是firebug中的响应头:
Cache-Control private, max-age=0
Content-Length 26070
Content-Type text/html; charset=utf-8
Date Sun, 10 Aug 2014 18:39:29 GMT
Expires Thu, 01 Dec 1994 16:00:00
Last-Modified Thu, 01 Dec 2000 16:00:00
Pragma no-cache
Server Development/2.0
Set-Cookie hl=en_US; Max-Age=157680000; Path=/; expires=Fri, 09-Aug-2019 18:39:29 GMT dvc=desktop; expires=Sun, 24-Aug-2014 18:39:29 GMT; path=/; HttpOnly session_name="eyJfdXNlciI6WzU2Mjk0OTk1MzQyMTMxMjAsMCwieHZITk5rbGpoSjVMOWllNFRVNVNHOSIsMTQwNzY5NTk1MiwxNDA3Njk1OTUyXX0\075|1407695969|433299a97d00e1d09a1f9670c17c5fb56524a214"; Path=/
x-ua-compatible IE=Edge,chrome=1
我无法弄清楚这一点。任何帮助将不胜感激,谢谢。
P.S。 bfcache是罪魁祸首,但为什么它不遵循标题的规则?