[英]Disable static file caching in Tornado
默认情况下,Tornado在StaticFileHandler
提供的任何文件上放置一个Cache-Control: public
头。 如何将其更改为Cache-Control: no-cache
?
接受的答案不适用于Chrome。 子类StaticFileHandler
使用以下内容:
class MyStaticFileHandler(tornado.web.StaticFileHandler):
def set_extra_headers(self, path):
# Disable cache
self.set_header('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0')
查看tornado / web.py似乎最简单的方法是子类化StaticFileHandler并覆盖set_extra_headers方法。
def set_extra_headers(self, path):
self.set_header("Cache-control", "no-cache")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.