Skip to content Skip to sidebar Skip to footer

Disable Browser Cache For Back Button?

This is what I have tried from Python/tornadoweb: self.set_header('Cache-Control','no-cache, must-revalidate, max-age=0') self.set_header('Expires','Mon, 26 Jul 1997 05:00:

Solution 1:

I don't know if you solved this issue or not, but I faced the same issue last night. This answer helped me to some extent. I solved it by setting the header and clearing the user cookie.

Here's a gist of what I did :

classBaseHandler(tornado.web.RequestHandler):defset_default_headers(self):
        self.set_header('Cache-Control', 'no-cache, no-store, must-revalidate')
        self.set_header('Pragma', 'no-cache')
        self.set_header('Expires', '0')

Now the SignOut handler :

classSignOut(BaseHandler):defget(self):
        self.clear_cookie("user")
        self.redirect('/')

"user" is the name of the cookie set.

Post a Comment for "Disable Browser Cache For Back Button?"