I'm working on an app that uses connect/express with node.js. It uses the "static" middleware like this:
var express = require("express");
var io = require("socket.io");
var app = express.createServer(
express.static(__dirname + '/static')
);
app.listen(process.env.PORT || 8080);
var listener = io.listen(app);
var lobby = listener.of("/lobby");
lobby.on("connection", function (socket) {
// etc etc etc
});
Within ./static
, there's a folder, ./static/mp3
, containing 88 audio files used by the app.
Though returning visitors have the files cached, it's driving me nuts that they still send 88 http requests to ask if their cached copies are out of date.
How can I enforce Expires
or max-age
caching, for only this folder?