如果其他人有相同的问题,这是解决方案:
function (req, res, next) { if ('HEAD' == req.method || 'OPTIONS' == req.method) return next(); // break session hash / force express to spit out a new cookie once per second at most req.session._garbage = Date(); req.session.touch(); next();}


