var express = require('express'); var app = express.createServer(); var oneYear = 31557600000; app.use(express.static(__dirname + '/public', { maxAge: oneYear })); app.use(express.errorHandler()); app.get('/', function(req, res){ res.send('hello world'); }); app.listen(3000);
Executing the above code and going to the test.html page, which is located in the / public directory and has a test image, gives me the following response headers, and Chrome Audit works fine on my PC (Chrome 17.0.963.83, Linux, Node 0.6.13, Express last). You should check if it is really in production mode.
Accept-Ranges:bytes Cache-Control:public, max-age=31557600 Connection:keep-alive Date:Fri, 23 Mar 2012 22:52:24 GMT ETag:"120877-1278958150000" Last-Modified:Mon, 12 Jul 2010 18:09:10 GMT X-Powered-By:Express
Mustafa
source share