fix(dashboard): prevent CDN caching of HTML pages to fix stale builds after deploy
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user