Show More
@@ -320,7 +320,7 class AuthenticatedFileHandler(IPythonHandler, web.StaticFileHandler): | |||
|
320 | 320 | |
|
321 | 321 | def set_headers(self): |
|
322 | 322 | super(AuthenticatedFileHandler, self).set_headers() |
|
323 |
# disable browser caching, rely |
|
|
323 | # disable browser caching, rely on 304 replies for savings | |
|
324 | 324 | if "v" not in self.request.arguments: |
|
325 | 325 | self.add_header("Cache-Control", "no-cache") |
|
326 | 326 | |
@@ -394,11 +394,14 class FileFindHandler(web.StaticFileHandler): | |||
|
394 | 394 | |
|
395 | 395 | def set_headers(self): |
|
396 | 396 | super(FileFindHandler, self).set_headers() |
|
397 |
# disable browser caching, rely |
|
|
398 |
if "v" not in self.request.arguments |
|
|
397 | # disable browser caching, rely on 304 replies for savings | |
|
398 | if "v" not in self.request.arguments or \ | |
|
399 | any(self.request.path.startswith(path) for path in self.no_cache_paths): | |
|
399 | 400 | self.add_header("Cache-Control", "no-cache") |
|
400 | 401 | |
|
401 | def initialize(self, path, default_filename=None): | |
|
402 | def initialize(self, path, default_filename=None, no_cache_paths=None): | |
|
403 | self.no_cache_paths = no_cache_paths or [] | |
|
404 | ||
|
402 | 405 | if isinstance(path, string_types): |
|
403 | 406 | path = [path] |
|
404 | 407 |
@@ -171,6 +171,10 class NotebookWebApplication(web.Application): | |||
|
171 | 171 | static_path=ipython_app.static_file_path, |
|
172 | 172 | static_handler_class = FileFindHandler, |
|
173 | 173 | static_url_prefix = url_path_join(base_url,'/static/'), |
|
174 | static_handler_args = { | |
|
175 | # don't cache custom.js | |
|
176 | 'no_cache_paths': [url_path_join(base_url, 'static', 'custom')], | |
|
177 | }, | |
|
174 | 178 | version_hash=version_hash, |
|
175 | 179 | |
|
176 | 180 | # authentication |
@@ -218,8 +222,12 class NotebookWebApplication(web.Application): | |||
|
218 | 222 | handlers.extend(load_handlers('services.sessions.handlers')) |
|
219 | 223 | handlers.extend(load_handlers('services.nbconvert.handlers')) |
|
220 | 224 | handlers.extend(load_handlers('services.kernelspecs.handlers')) |
|
225 | ||
|
221 | 226 | handlers.append( |
|
222 |
(r"/nbextensions/(.*)", FileFindHandler, { |
|
|
227 | (r"/nbextensions/(.*)", FileFindHandler, { | |
|
228 | 'path': settings['nbextensions_path'], | |
|
229 | 'no_cache_paths': ['/'], # don't cache anything in nbextensions | |
|
230 | }), | |
|
223 | 231 | ) |
|
224 | 232 | # register base handlers last |
|
225 | 233 | handlers.extend(load_handlers('base.handlers')) |
General Comments 0
You need to be logged in to leave comments.
Login now