How to prevent cached response (flask server, using chrome)
To prevent cached responses from the browser:- press F12 or right click > inspect- click network tab- check "Disable cache".
To prevent cached responses from the server: add the following definition to application.py:
# prevent cached responsesif app.config["DEBUG"]: @app.after_request def after_request(response): response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate, public, max-age=0" response.headers["Expires"] = 0 response.headers["Pragma"] = "no-cache" return response