Node.js和Express会话处理-后退按钮问题

Node.js和Express会话处理-后退按钮问题,第1张

Node.js和Express会话处理-后退按钮问题

并采用了该node.js / express问题的答案。您只需要更改以下行

res.header('Cache-Control', 'no-cache');

res.header('Cache-Control', 'no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0');

现在,每次我使用浏览器的后退按钮时,页面都会重新加载而不被缓存。

更新Express v4.x

// caching disabled for every routeserver.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


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5477135.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-12
下一篇 2022-12-12

发表评论

登录后才能评论

评论列表(0条)

保存