1

I have an app using express and Node.js. In this app user login using credential and then generate JWT token to authenticate further HTTP request. I am trying to remove browser cache so when user log out there should be no browser cache web page when the user hit back/forward button. I did some research and tried some solutions but no success. One of them is -

app.use(function (req, res, next) {
    res.header('Cache-Control', 'private, no-cache, no-store, must-revalidate');
    res.header('Expires', '-1');
    res.header('Pragma', 'no-cache');
    next()
});

Please guide. Thanks

user557657
  • 856
  • 1
  • 12
  • 35
  • For reference: https://stackoverflow.com/questions/20429592/no-cache-in-a-nodejs-server/20429914#20429914 @OP: How are you implementing this? Did you double-check in the browser that the page loads with the stated headers? –  Feb 06 '18 at 15:02
  • @ChrisG - yes I see the stated header in the browser. I am using the same reference you mentioned in the comment. – user557657 Feb 06 '18 at 15:07
  • 1
    This question is basically OT because we cannot replicate this. Can you put a [mcve] on github or the like? –  Feb 06 '18 at 15:27

0 Answers0