Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 Screenshot

like image 948
Paul Avatar asked Oct 21 '22 02:10

Paul


1 Answers

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.

like image 61
Holger Frank Avatar answered Oct 27 '22 20:10

Holger Frank