You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* fix inconsistencies between rsc or json and html in the cdn
* fix 5 minute min revalidate
* exclude ssg pages
* only apply revalidate for stale page
* bypass middleware for isr
* add changeset
// If the cache is stale, we revalidate in the background
117
-
// In order for CloudFront SWR to work, we set the stale-while-revalidate value to 2 seconds
118
-
// This will cause CloudFront to cache the stale data for a short period of time while we revalidate in the background
119
-
// Once the revalidation is complete, CloudFront will serve the fresh data
120
-
headers[CommonHeaders.CACHE_CONTROL]=
121
-
"s-maxage=2, stale-while-revalidate=2592000";
122
-
123
-
// If the URL is rewritten, revalidation needs to be done on the rewritten URL.
124
-
// - Link to Next.js doc: https://nextjs.org/docs/pages/building-your-application/data-fetching/incremental-static-regeneration#on-demand-revalidation
125
-
// - Link to NextInternalRequestMeta: https://github.com/vercel/next.js/blob/57ab2818b93627e91c937a130fb56a36c41629c3/packages/next/src/server/request-meta.ts#L11
debug(`Failed to revalidate stale page ${rawPath}`);
159
-
debug(e);
110
+
fixISRHeaders(headers);
111
+
112
+
if(headers[CommonHeaders.NEXT_CACHE]==="STALE"){
113
+
// If the URL is rewritten, revalidation needs to be done on the rewritten URL.
114
+
// - Link to Next.js doc: https://nextjs.org/docs/pages/building-your-application/data-fetching/incremental-static-regeneration#on-demand-revalidation
115
+
// - Link to NextInternalRequestMeta: https://github.com/vercel/next.js/blob/57ab2818b93627e91c937a130fb56a36c41629c3/packages/next/src/server/request-meta.ts#L11
0 commit comments