set no-cache header in StaticFileHandlers

rely on 304 Not Modified for caching content
This commit is contained in:
MinRK 2014-09-15 11:45:48 -07:00 committed by Min RK
parent b72ac07c3d
commit fe730a60c2

View File

@ -312,6 +312,12 @@ class AuthenticatedFileHandler(IPythonHandler, web.StaticFileHandler):
return web.StaticFileHandler.get(self, path)
def set_headers(self):
super(AuthenticatedFileHandler, self).set_headers()
# disable browser caching, rely in 304 replies for savings
if "v" not in self.request.arguments:
self.add_header("Cache-Control", "no-cache")
def compute_etag(self):
return None
@ -380,6 +386,12 @@ class FileFindHandler(web.StaticFileHandler):
# cache search results, don't search for files more than once
_static_paths = {}
def set_headers(self):
super(FileFindHandler, self).set_headers()
# disable browser caching, rely in 304 replies for savings
if "v" not in self.request.arguments:
self.add_header("Cache-Control", "no-cache")
def initialize(self, path, default_filename=None):
if isinstance(path, string_types):
path = [path]