Skip to content

Commit

Permalink
Rebase with main
Browse files Browse the repository at this point in the history
Signed-off-by: Marcos Candeia <marrcooos@gmail.com>
  • Loading branch information
mcandeia committed Aug 1, 2024
1 parent 01b637a commit edd0cca
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion runtime/routes/render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const handler = createHandler(async (
return new Response(null, { status: 304, headers: { etag } });
}

if (shouldCache && etag) {
if (shouldCache && etag && ctx?.var?.vary?.shouldCache) {
response.headers.set("etag", etag);

// Stale cache on CDN, but make the browser fetch every single time.
Expand All @@ -89,6 +89,11 @@ export const handler = createHandler(async (
"cache-control",
"public, max-age=0, must-revalidate, s-maxage=60, stale-while-revalidate=3600, stale-if-error=86400",
);
} else {
response.headers.set(
"cache-control",
"public, max-age=0, must-revalidate",
);
}

return response;
Expand Down

0 comments on commit edd0cca

Please sign in to comment.