From fde2782a9eb5dcd7a706bee2401ce44c891c3653 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 14 Apr 2018 01:45:44 +0900 Subject: [PATCH] Cache url preview --- src/server/web/url-preview.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/server/web/url-preview.ts b/src/server/web/url-preview.ts index 4b3f44a5da..d5464d0cd4 100644 --- a/src/server/web/url-preview.ts +++ b/src/server/web/url-preview.ts @@ -5,6 +5,10 @@ module.exports = async (ctx: Koa.Context) => { const summary = await summaly(ctx.query.url); summary.icon = wrap(summary.icon); summary.thumbnail = wrap(summary.thumbnail); + + // Cache 7days + ctx.set('Cache-Control', 'max-age=604800, immutable'); + ctx.body = summary; };