Expire session in flask in ajax context
问题 I am using permanent_session_lifetime to expire the session of the user after some period of inactivity. The problem is that, this request is made through ajax, so i can't redirect in ajax context with the normal behavior of the flask. http://xxxx/login?next=%2Fusers%2Fajax_step1 Instead of this, I want to redirect to my logout route in the before_request , if the flask session expire. How can i do that? @mod.before_request def make_session_permanent(): session.modified = True session