我对后退按钮有疑问。我们知道,按下注销按钮后,如果用户按下后退按钮,则必须重定向到登录页面而不是经过身份验证的页面。 我试图找到解决方案,但在我的情况下无法解决它。
提前致谢
这是我的routes.js 屏幕截图:
最佳答案
当用户在浏览器中导航回来时,数据将显示在本地浏览器缓存中,而不是从您的服务器请求。
使用以下设置,当浏览器后退按钮时,页面将重新加载且不会缓存。
// caching disabled for every route
server.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();
});
// otherwise put the res.set() call into the route-handler you want
关于node.js - ExpressJs、Node Js、Passport - 注销后退按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45909732/