diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-12-16 11:49:01 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-12-16 11:49:12 +0100 |
commit | 4bfc14555680e861df8ce09c0d9e309bdc1509fd (patch) | |
tree | 41cbe0caf0d56dd94601d15c3a9be647f533d67b | |
parent | Plugin locations cleanup after merge from stable (diff) | |
download | pyload-4bfc14555680e861df8ce09c0d9e309bdc1509fd.tar.xz |
improved caching directives, tell browser not to cache the index page
-rw-r--r-- | pyload/web/pyload_app.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/pyload/web/pyload_app.py b/pyload/web/pyload_app.py index 1a54c4a93..597f1525b 100644 --- a/pyload/web/pyload_app.py +++ b/pyload/web/pyload_app.py @@ -62,6 +62,7 @@ def i18n(lang=None): return json_dumps({}) + @route('/') def index(): if UNAVAILALBE: @@ -84,15 +85,14 @@ def index(): resp.body = template(content, ws=ws, web=web, setup=setup, external=external, prefix=PREFIX) resp.content_length = len(resp.body) + # tell the browser to don't cache it + resp.headers["Cache-Control"] = "no-cache, must-revalidate" + return resp # Very last route that is registered, could match all uris @route('/<path:path>') def serve_static(path): - response.headers['Expires'] = time.strftime("%a, %d %b %Y %H:%M:%S GMT", - time.gmtime(time.time() + 60 * 60 * 24 * 7)) - response.headers['Cache-control'] = "public" - # save if this resource is available as gz if path not in GZIPPED: GZIPPED[path] = exists(join(APP_ROOT, path + ".gz")) @@ -107,6 +107,9 @@ def serve_static(path): resp = static_file(path, root=APP_ROOT) # Also serve from .tmp folder in dev mode if resp.status_code == 404 and APP_PATH == "app": - return static_file(path, root=join(PROJECT_DIR, '.tmp')) + resp = static_file(path, root=join(PROJECT_DIR, '.tmp')) + + if resp.status_code == 200: + resp.headers['Cache-control'] = "public" return resp
\ No newline at end of file |