fix: static caching
This commit is contained in:
@@ -85,7 +85,7 @@ export const DocumentUploadDropzone = ({ className }: DocumentUploadDropzoneProp
|
|||||||
timestamp: new Date().toISOString(),
|
timestamp: new Date().toISOString(),
|
||||||
});
|
});
|
||||||
|
|
||||||
void navigate(`${formatDocumentsPath(team?.url)}/${id}/edit`);
|
await navigate(`${formatDocumentsPath(team?.url)}/${id}/edit`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const error = AppError.parseError(err);
|
const error = AppError.parseError(err);
|
||||||
|
|
||||||
|
|||||||
@@ -19,10 +19,16 @@ server.use(
|
|||||||
onFound: (path, c) => {
|
onFound: (path, c) => {
|
||||||
if (path.startsWith('./build/client/assets')) {
|
if (path.startsWith('./build/client/assets')) {
|
||||||
// Hard cache assets with hashed file names.
|
// Hard cache assets with hashed file names.
|
||||||
c.header('Cache-Control', `public, immutable, max-age=31536000`);
|
c.header('Cache-Control', 'public, immutable, max-age=31536000');
|
||||||
} else {
|
} else {
|
||||||
// Cache with revalidation for rest of static files.
|
// Cache with revalidation for rest of static files.
|
||||||
c.header('Cache-Control', 'no-cache, stale-while-revalidate');
|
c.header('Cache-Control', 'public, max-age=0, stale-while-revalidate=86400');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom cache for static file pdf.worker.min.js
|
||||||
|
if (path === './build/client/pdf.worker.min.js') {
|
||||||
|
c.header('Cache-Control', 'public, max-age=3600, stale-while-revalidate=86400');
|
||||||
|
c.header('ETag', 'pdf.worker.min.js');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user