From fe730a60c2d829cfee8f62dff9ba312e258d2cf2 Mon Sep 17 00:00:00 2001 From: MinRK Date: Mon, 15 Sep 2014 11:45:48 -0700 Subject: [PATCH] set no-cache header in StaticFileHandlers rely on 304 Not Modified for caching content --- IPython/html/base/handlers.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/IPython/html/base/handlers.py b/IPython/html/base/handlers.py index 906a44cdc..602939245 100644 --- a/IPython/html/base/handlers.py +++ b/IPython/html/base/handlers.py @@ -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]