Cache-Control
This commit is contained in:
6
app.py
6
app.py
@@ -33,16 +33,14 @@ item6 = 0
|
|||||||
app.logger.info('Starting erdbeerhannah v' + version)
|
app.logger.info('Starting erdbeerhannah v' + version)
|
||||||
|
|
||||||
# prevent cached responses
|
# prevent cached responses
|
||||||
|
# https://stackoverflow.com/questions/47376744/how-to-prevent-cached-response-flask-server-using-chrome
|
||||||
@app.after_request
|
@app.after_request
|
||||||
def add_header(r):
|
def add_header(r):
|
||||||
"""
|
"""
|
||||||
Add headers to both force latest IE rendering engine or Chrome Frame,
|
Add headers to both force latest IE rendering engine or Chrome Frame,
|
||||||
and also to cache the rendered page for 10 minutes.
|
and also to cache the rendered page for 10 minutes.
|
||||||
"""
|
"""
|
||||||
r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
|
r.headers["Cache-Control"] = "no-store, max-age=0"
|
||||||
r.headers["Pragma"] = "no-cache"
|
|
||||||
r.headers["Expires"] = "0"
|
|
||||||
r.headers['Cache-Control'] = 'public, max-age=0'
|
|
||||||
return r
|
return r
|
||||||
|
|
||||||
@app.route("/", methods=["GET", "POST"])
|
@app.route("/", methods=["GET", "POST"])
|
||||||
|
Reference in New Issue
Block a user