fix(dashboard): prevent CDN caching of HTML pages to fix stale builds after deploy

This commit is contained in:
Rotimi Best
2026-07-07 21:14:10 +01:00
parent 2e402efa78
commit af95c6280c
+7
View File
@@ -62,6 +62,13 @@ export const handle: Handle = async (args) => {
response = await handlePagesRoutes(args);
}
// Prevent Cloudflare/CDN from caching HTML pages — stale HTML references old
// hashed JS/CSS bundles after a deploy, causing the app to hang on deep links.
const contentType = response.headers.get('content-type') ?? '';
if (contentType.includes('text/html')) {
response.headers.set('Cache-Control', 'private, no-cache, must-revalidate');
}
return applyCspExtensions(response);
};