mirror of
https://github.com/documenso/documenso.git
synced 2025-11-12 07:43:16 +10:00
feat: add static cache
This commit is contained in:
@ -16,6 +16,15 @@ import * as build from './index.js';
|
||||
server.use(
|
||||
serveStatic({
|
||||
root: 'build/client',
|
||||
onFound: (path, c) => {
|
||||
if (path.startsWith('./build/client/assets')) {
|
||||
// Hard cache assets with hashed file names.
|
||||
c.header('Cache-Control', `public, immutable, max-age=31536000`);
|
||||
} else {
|
||||
// Cache with revalidation for rest of static files.
|
||||
c.header('Cache-Control', 'no-cache, stale-while-revalidate');
|
||||
}
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user