1

I use passport.js in my node program, for authorization control,

suppose I have two page in different authorization

//need authorization
app.get('/admin', checkaccess, function (req, res) {

})

//doesn't need authorization
app.get('/blog', function () {

})

when I log in and at page /admin, I jump to /blog in the same window, then I clear the cookie,

it means that I can't access /admin any more, if I open a new window, and try to /admin, indeed I can't,

but when I use the back button in browser at the /blog to switch to /admin, it success!

Is it a cache problem?How can I stop this happend?

hh54188
  • 14,887
  • 32
  • 113
  • 184

1 Answers1

0

I believe something like this should help.

//need authorization
app.get('/admin', checkaccess, function (req, res) {
    res.header('Cache-Control', 'no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0');


})

//doesn't need authorization
app.get('/blog', function () {

})
thtsigma
  • 4,878
  • 2
  • 28
  • 29