I am using Nodejs and Express Js. Also I add NowJS to the Express Js to do some real-time stuffs.
In the configuration file I have
app.configure('production', function() {
var oneYear = 31557600000;
app.use(express.static(__dirname + '/public', { maxAge: oneYear }));
app.use(express.errorHandler());});
And I run the application using this command:
$ NODE_ENV=production node app.js
However, the files(images, css, js) seem not to be cached, they are always served as new file.
P/s: I have just tested it with localhost, the cache seems to work on localhost, however, when uploading to the server, the cache is not working anymore.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…