Explicitly set max-age (#3330)

This commit is contained in:
MeiMei 2018-11-20 05:29:51 +09:00 committed by syuilo
parent ca0cb6fd42
commit e332e3c248
3 changed files with 10 additions and 0 deletions

View file

@ -189,6 +189,8 @@ router.get('/*/api/endpoints/*', async ctx => {
};
await ctx.render('../../../../src/docs/api/endpoints/view', Object.assign(await genVars(lang), vars));
ctx.set('Cache-Control', 'public, max-age=300');
});
router.get('/*/api/entities/*', async ctx => {
@ -204,6 +206,8 @@ router.get('/*/api/entities/*', async ctx => {
props: sortParams(Object.entries(x.props).map(([k, v]) => parsePropDefinition(k, v))),
propDefs: extractPropDefRef(x.props)
}));
ctx.set('Cache-Control', 'public, max-age=300');
});
router.get('/*/*', async ctx => {
@ -240,6 +244,8 @@ router.get('/*/*', async ctx => {
title: md.match(/^# (.+?)\r?\n/)[1],
src: `https://github.com/syuilo/misskey/tree/master/src/docs/${doc}.${lang}.md`
}, await genVars(lang)));
ctx.set('Cache-Control', 'public, max-age=300');
});
export default router;

View file

@ -94,6 +94,7 @@ router.get('/@:user', async (ctx, next) => {
if (user != null) {
await ctx.render('user', { user });
ctx.set('Cache-Control', 'public, max-age=180');
} else {
// リモートユーザーなので
await next();
@ -110,6 +111,7 @@ router.get('/notes/:note', async ctx => {
note: _note,
summary: getNoteSummary(_note)
});
ctx.set('Cache-Control', 'public, max-age=180');
} else {
ctx.status = 404;
}

View file

@ -68,6 +68,8 @@ router.get('/.well-known/webfinger', async ctx => {
template: `${config.url}/authorize-follow?acct={uri}`
}]
};
ctx.set('Cache-Control', 'public, max-age=180');
});
export default router;