Flask-后退按钮即使在注销后也可以返回会话 [英] Flask- Back Button Returns to Session Even after Logout

查看:53
本文介绍了Flask-后退按钮即使在注销后也可以返回会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Flask创建一个需要登录和注销的网站.我正在使用Flask-Security来解决这个问题.我的问题是,注销后,如果单击后退"按钮,则会返回到用户页面.是否可以通过按Flask中的后退"按钮来防止注销后返回会话?

I am creating a website using flask that requires logging in and out. I am using Flask-Security to help with this. My problem is that after I log out, if I hit the back button, I return to the user's page. Is there a way to prevent returning to a session after logging out by pressing the back button in Flask?

推荐答案

使用 Cache-Control 标头可防止页面被缓存.

Use the Cache-Control header to prevent a page from being cached.

response.headers.add('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0')   

这篇关于Flask-后退按钮即使在注销后也可以返回会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆