From 72766966f36345ac28955f73bf9cf5ab5b913d44 Mon Sep 17 00:00:00 2001 From: Jori Lallo Date: Wed, 1 Jun 2016 16:48:35 -0700 Subject: [PATCH] Add cache headers for static files --- server/routes.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/routes.js b/server/routes.js index 53ab80ca3..da5f5b018 100644 --- a/server/routes.js +++ b/server/routes.js @@ -27,7 +27,10 @@ if (process.env.NODE_ENV === 'production') { }); router.get('/static/*', async (ctx) => { - console.log(path.join(__dirname, '../dist/', ctx.path.substring(8))); + ctx.set({ + 'Cache-Control': 'max-age=999999999999', + }); + const stats = await sendfile(ctx, path.join(__dirname, '../dist/', ctx.path.substring(8))); }); @@ -56,4 +59,4 @@ koa.use(async () => { throw httpErrors.NotFound(); }); -export default koa; \ No newline at end of file +export default koa;