简体   繁体   中英

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

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:

Chrome DevTools截图

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM