summary refs log tree commit diff
path: root/src/cdn/util/cache.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/cdn/util/cache.ts')
-rw-r--r--src/cdn/util/cache.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cdn/util/cache.ts b/src/cdn/util/cache.ts
new file mode 100644

index 00000000..c48087dd --- /dev/null +++ b/src/cdn/util/cache.ts
@@ -0,0 +1,7 @@ +import { NextFunction, Response, Request } from "express"; + +export function cache(req: Request, res: Response, next: NextFunction) { + const durationInSeconds = 21600; // 6 hours + res.set("Cache-Control", `public, max-age=${durationInSeconds}, s-maxage=${durationInSeconds}, immutable`); + next(); +}