Skip to content

Commit a9b526d

Browse files
committed
alter cache control values
1 parent ad52193 commit a9b526d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/fern-docs/bundle/src/middleware.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,8 @@ export const middleware: NextMiddleware = async (request) => {
331331
});
332332
const response = rewrite(rewritePath);
333333
// Set CDN cache headers for static pages: no browser cache, 7 min CDN cache + 1 day stale-while-revalidate
334-
response.headers.set("Cache-Control", "public, max-age=0, s-maxage=420, stale-while-revalidate=86400");
335-
response.headers.set("CDN-Cache-Control", "max-age=420, stale-while-revalidate=86400");
334+
response.headers.set("Cache-Control", "public, max-age=1, s-maxage=1, stale-while-revalidate=120");
335+
response.headers.set("CDN-Cache-Control", "max-age=1, stale-while-revalidate=120");
336336
return response;
337337
}
338338

@@ -347,9 +347,9 @@ export const middleware: NextMiddleware = async (request) => {
347347
}
348348

349349
const response = rewrite(withDomain(`/static/${encodeURIComponent(conformTrailingSlash(pathname))}`));
350-
response.headers.set("Cache-Control", "public, max-age=0, s-maxage=420, stale-while-revalidate=86400"); // no browser cache, 7 min CDN cache, 1 day stale-while-revalidate
351-
response.headers.set("CDN-Cache-Control", "max-age=420, stale-while-revalidate=86400");
352-
response.headers.set("Vercel-CDN-Cache-Control", "max-age=86400, stale-while-revalidate=86400"); // longer value for vercel CDN since it respects invalidateTag
350+
response.headers.set("Cache-Control", "public, max-age=1, s-maxage=1, stale-while-revalidate=120");
351+
response.headers.set("CDN-Cache-Control", "max-age=1, stale-while-revalidate=120");
352+
response.headers.set("Vercel-CDN-Cache-Control", "max-age=86400, stale-while-revalidate=120");
353353
return response;
354354
};
355355

0 commit comments

Comments
 (0)