From 151864f1d40d6499af3367ab56f74336f3f06f0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 29 Jan 2015 16:36:08 +0100 Subject: [PATCH] Always send responses to POST requests with Cache-Control: no-cache --- src/octoprint/server/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index a96263e7..e723d2fe 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -89,6 +89,13 @@ LANGUAGES = get_available_locale_identifiers(LOCALES) def before_request(): g.locale = get_locale() +@app.after_request +def after_request(response): + # send no-cache headers with all POST responses + if request.method == "POST": + response.cache_control.no_cache = True + return response + @babel.localeselector def get_locale():