Skip to content

Commit 771f007

Browse files
author
Ke, Mingze
committed
Set Cache-Control: max-age for static content (default: 1 day)
1 parent 8a4f539 commit 771f007

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

config.default.json

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"runner": false
1010
},
1111
"max-request-size": "1MB",
12+
"max-age": 86400,
1213
"store": {
1314
"adapter": "sqlite",
1415
"sqlite": {

lib/app.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ app.connect = function (callback) {
218218
// look like a bin url) then it gets 404'd - i.e. you can't request /css/style.css
219219
// because it'll return a 404.
220220
app.use(mount, (function () {
221-
var staticRouter = express.static(path.join(app.get('root'), 'public'));
221+
var staticRouter = express.static(path.join(app.get('root'), 'public'),
222+
{maxAge: (options['max-age'] || 86400) * 1000});
222223

223224
return function (req, res, next) {
224225
// construct the full request url

0 commit comments

Comments
 (0)