diff --git a/src/proxy.ts b/src/proxy.ts index 1a2fefcd..7b455170 100644 --- a/src/proxy.ts +++ b/src/proxy.ts @@ -40,17 +40,14 @@ export const proxy = async (req: import("next/server").NextRequest) => { const response = NextResponse.next({ request: { headers } }); - if (token) { - response.headers.set( - "Cache-Control", - "private, no-cache, no-store, max-age=0, must-revalidate", - ); - } else { - response.headers.set( - "Cache-Control", - "public, max-age=60, s-maxage=300, stale-while-revalidate=300", - ); - } + // HTML is never cached (browser/CDN/edge) so that after a deploy the page + // always references the current build's chunks. Static assets are + // content-hashed + immutable and can be cached aggressively; a stale HTML + // document would reference chunk URLs that no longer exist after a rebuild. + response.headers.set( + "Cache-Control", + "private, no-cache, no-store, max-age=0, must-revalidate", + ); for (const [key, value] of Object.entries(SECURITY_HEADERS)) { response.headers.set(key, value);