Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Stricted HTML cache validation

Blue Mousec61b4a7d0833
diff --git a/web/app/entry.server.tsx b/web/app/entry.server.tsx
index ef11977f9..9df808ce5 100644
--- a/web/app/entry.server.tsx
+++ b/web/app/entry.server.tsx
@@ -68,7 +68,14 @@ export default async function handleRequest(
responseHeaders.set('Content-Type', 'text/html')
// Prevent HTML from being cached so users always get fresh chunk references after deployments
- responseHeaders.set('Cache-Control', 'no-cache, no-store, must-revalidate')
+ responseHeaders.set('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0')
+ responseHeaders.set('Pragma', 'no-cache')
+ responseHeaders.set('Expires', '0')
+ responseHeaders.append('Vary', 'Cookie')
+
+ // Remove headers that might trigger 304 Not Modified
+ responseHeaders.delete('ETag')
+ responseHeaders.delete('Last-Modified')
resolve(
new Response(stream, {
diff --git a/web/app/root.tsx b/web/app/root.tsx
index 98f896087..91ea41e84 100644
--- a/web/app/root.tsx
+++ b/web/app/root.tsx
@@ -64,8 +64,11 @@ export const headers: HeadersFunction = () => ({
'X-Powered-By': 'Mountain Dew',
// Theme detection headers (browser hints)
'Accept-CH': 'Sec-CH-Prefers-Color-Scheme',
- Vary: 'Sec-CH-Prefers-Color-Scheme',
+ Vary: 'Sec-CH-Prefers-Color-Scheme, Cookie',
'Critical-CH': 'Sec-CH-Prefers-Color-Scheme',
+ 'Cache-Control': 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0',
+ Pragma: 'no-cache',
+ Expires: '0',
})
export function ErrorBoundary() {