Node.js and Express session handling - Back button problem

后端 未结 4 1897
無奈伤痛
無奈伤痛 2020-12-23 19:04

I have a restricted area \'/dashboard\' in my Express application. I use a very small function to limit the access:

app.get(\'/dashboard\', loadUser, functi         


        
4条回答
  •  抹茶落季
    2020-12-23 19:49

    Am using using Express ^4.16.3 and this worked for me as stated by @pkyeck.

    I added it to my routes like this and it worked fine:

    routes
    .use(function(req, res, next) {
    res.set('Cache-Control', 'no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0');
            next();
              })
              .get('/login', function(req, res, next){
                  .....
    })
    

提交回复
热议问题