Skip to content

Commit

Permalink
perf(caching): increase HTTP caching for static assets
Browse files Browse the repository at this point in the history
269d26e has been in production for a while successfully; this increases the time browsers are allowed to cache assets to the maximum value of 1 year.

Refs #392
  • Loading branch information
thewilkybarkid committed Sep 10, 2021
1 parent 17cce4e commit 6a15fe9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/backend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,10 @@ export default async function configServer(config) {
serveStatic(STATIC_DIR, {
setHeaders: (res, path) => {
if (path.match(/\.[a-z0-9]{8}\.[A-z0-9]+(?:\.map)?$/)) {
res.setHeader('Cache-Control', 'public, max-age=60, immutable');
res.setHeader(
'Cache-Control',
`public, max-age=${60 * 60 * 24 * 365}, immutable`,
);
}
},
}),
Expand Down

0 comments on commit 6a15fe9

Please sign in to comment.