From d475b02b66ac685b8f526e71cbe4785eeda9ead9 Mon Sep 17 00:00:00 2001
From: Tamas Gal <tgal@km3net.de>
Date: Mon, 22 Oct 2018 12:18:29 +0200
Subject: [PATCH] Disable caches

---
 app/routes.py | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/app/routes.py b/app/routes.py
index c71972c..c021708 100644
--- a/app/routes.py
+++ b/app/routes.py
@@ -2,15 +2,25 @@ from os.path import join
 from flask import render_template, send_from_directory
 from app import app
 
-
 PLOTS_PATH = "../plots"
 
-
 PLOTS = [
-        ['dom_activity', 'dom_rates'],
-        ['pmt_rates', 'pmt_hrv'],
-        ['trigger_rates'],
-        ]
+    ['dom_activity', 'dom_rates'],
+    ['pmt_rates', 'pmt_hrv'],
+    ['trigger_rates'],
+]
+
+
+@app.after_request
+def add_header(r):
+    """
+    Disable caches.
+    """
+    r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
+    r.headers["Pragma"] = "no-cache"
+    r.headers["Expires"] = "0"
+    r.headers["Cache-Control"] = "public, max-age=0"
+    return r
 
 
 @app.route('/')
-- 
GitLab