mirror of
https://github.com/jupyter/notebook.git
synced 2025-02-05 12:19:58 +08:00
set no-cache header in StaticFileHandlers
rely on 304 Not Modified for caching content
This commit is contained in:
parent
b72ac07c3d
commit
fe730a60c2
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user