Browser caching issues in flask

后端 未结 2 1699
南旧
南旧 2020-12-05 01:13

I have built a website using flask (www.csppdb.com). Sometimes when I log in as one user, log out, then login as another user I still see pages from the first user I logged

2条回答
  •  情书的邮戳
    2020-12-05 01:36

    Setting the cache to be max-age=0 fixed it.

    @app.after_request
    def add_header(response):
        """
        Add headers to both force latest IE rendering engine or Chrome Frame,
        and also to cache the rendered page for 10 minutes.
        """
        response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'
        response.headers['Cache-Control'] = 'public, max-age=0'
        return response
    

提交回复
热议问题