diff --git a/server.js b/server.js index 43f7aa7..6395477 100644 --- a/server.js +++ b/server.js @@ -8,7 +8,11 @@ import { IS_PROD, BIND, PORT, LIMIT_SIZE } from "./src/constants.js"; const app = new Koa(); // static server -app.use(serve(IS_PROD ? "./static/dist" : "./static")); +app.use( + serve(IS_PROD ? "./static/dist" : "./static", { + maxAge: 2592000 * 1000, // 30d in milliseconds + }) +); // views render(app, { diff --git a/src/routes.js b/src/routes.js index 9cf97df..aa39810 100644 --- a/src/routes.js +++ b/src/routes.js @@ -32,6 +32,7 @@ router.get("/:uuid{.:ext}", async (ctx, next) => { return await ctx.render("view", gist); } + ctx.set("Cache-Control", "max-age=2592000"); // 30d in seconds ctx.set("X-IV", gist.iv); ctx.body = Buffer.from(gist.cipherText); });