并采用了该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
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)