From f58dd6bb8ec8d86d76c6ce0953086873326ddbee Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Tue, 20 Nov 2018 05:29:51 +0900 Subject: [PATCH] Explicitly set max-age (#3330) --- src/server/web/docs.ts | 6 ++++++ src/server/web/index.ts | 2 ++ src/server/webfinger.ts | 2 ++ 3 files changed, 10 insertions(+) diff --git a/src/server/web/docs.ts b/src/server/web/docs.ts index d91813c86..b535a236d 100644 --- a/src/server/web/docs.ts +++ b/src/server/web/docs.ts @@ -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; diff --git a/src/server/web/index.ts b/src/server/web/index.ts index 42203471a..616aaa36b 100644 --- a/src/server/web/index.ts +++ b/src/server/web/index.ts @@ -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; } diff --git a/src/server/webfinger.ts b/src/server/webfinger.ts index 6c2afae79..0f3e53b60 100644 --- a/src/server/webfinger.ts +++ b/src/server/webfinger.ts @@ -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;