From a8f479c56e000b542bccc51c32815ad1ff5f5a70 Mon Sep 17 00:00:00 2001 From: Alan Friedman Date: Fri, 14 Jun 2019 10:24:14 -0400 Subject: [PATCH] Cache static assets for one year (#83) * Cache static assets for one year * Use milliseconds --- server/src/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/src/index.js b/server/src/index.js index c76b3de..585d2e9 100644 --- a/server/src/index.js +++ b/server/src/index.js @@ -86,7 +86,9 @@ const clientDistDirectory = process.env.CLIENT_DIST_DIRECTORY; if (clientDistDirectory) { app.use(async (ctx, next) => { setStaticFileHeaders(ctx); - await koaStatic(clientDistDirectory)(ctx, next); + await koaStatic(clientDistDirectory, { + maxage: 365 * 24 * 60 * 60 * 1000 // one year in milliseconds + })(ctx, next); }); app.use(async (ctx) => {