Cache-Control

This commit is contained in:
elpatron68
2024-05-27 19:09:48 +02:00
parent 9318f0b25c
commit 57930c374a

6
app.py
View File

@@ -33,16 +33,14 @@ item6 = 0
app.logger.info('Starting erdbeerhannah v' + version)
# prevent cached responses
# https://stackoverflow.com/questions/47376744/how-to-prevent-cached-response-flask-server-using-chrome
@app.after_request
def add_header(r):
"""
Add headers to both force latest IE rendering engine or Chrome Frame,
and also to cache the rendered page for 10 minutes.
"""
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'
r.headers["Cache-Control"] = "no-store, max-age=0"
return r
@app.route("/", methods=["GET", "POST"])