Skip to content

Instantly share code, notes, and snippets.

@dannycroft
Created December 5, 2013 18:04
Show Gist options
  • Select an option

  • Save dannycroft/7810250 to your computer and use it in GitHub Desktop.

Select an option

Save dannycroft/7810250 to your computer and use it in GitHub Desktop.
var app = express.createServer(
(function(req, res, next) {
if(req.url.indexOf("/stylesheets/") === 0) {
res.setHeader("Cache-Control", "public, max-age=345600"); // 4 days
res.setHeader("Expires", new Date(Date.now() + 345600000).toUTCString());
}
return next();
}),
express.static(__dirname + '/static')
);
app.listen(process.env.PORT || 8080);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment