J
J
Jumandjilos2018-06-14 18:52:36
Node.js
Jumandjilos, 2018-06-14 18:52:36

How to disable page caching?

I have a page for adding an article, available only to an authorized user, but if you log in, go to this page, then click on the exit button, here is its code:

router.get('/logout', (req, res) => {
  if(req.session) {
    req.session.destroy(() => {
      res.redirect('/');
    })
  } else {
    res.redirect('/');
  }
})

then, in theory, the session is destroyed, but when you press the back button, you are authorized again, and again you can go to the closed page, which I correctly understood, this is due to page caching, if I'm right, tell me how to disable caching of this particular page, or tell me what is the problem. Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Aksentiev, 2018-06-14
@Sanasol

What's wrong with a cached page with old data locally in the browser?
Now, if requests go away when you return back and they work, then there is a jamb on the backend in the authorization check.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question