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

View File

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

View File

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