Node.js + Express.js on Windows: Static files pending for up to two minutes?

时间秒杀一切 提交于 2019-12-12 12:21:14

问题


I'm having an issue on my Windows environment with Node.Js/Express.js whereby static JS files can be marked as 'pending' in the browser (with caching disabled) for up to two minutes, after which they seem to download fine. This usually happens after a few refreshes.

There aren't any errors shown, so I'm not sure how to investigate further. The same code runs fine on a Mac OSX environment.

Node version is v0.10.31, Express is 4.8.5.

Code for static file is:

app.use(express.static(path.join(__dirname, 'public')));

Chrome DevTools shows:


回答1:


I had the same problem. The solution for me was to set the resave property of express-session to false.

app.use(session({ resave : false, ... }));

My configuration: node v0.10.31, express v4.9.0, express-session v1.8.1

As session storage I use connect-mongo v0.4.1.

Hope this helps you.



来源:https://stackoverflow.com/questions/25488917/node-js-express-js-on-windows-static-files-pending-for-up-to-two-minutes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!