Disable static file caching in Tornado Disable static file caching in Tornado python python

Disable static file caching in Tornado


The accepted answer does not work for Chrome. Subclass StaticFileHandler using the following:

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')


Looking into the tornado/web.py it seems that the easiest way is to subclass the StaticFileHandler and override the set_extra_headers method.

def set_extra_headers(self, path):    self.set_header("Cache-control", "no-cache")