File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
packages/runtime/src/templates Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -54,11 +54,14 @@ const getNetlifyNextServer = (NextServer: NextServerType) => {
54
54
return
55
55
}
56
56
57
- // force Next to revalidate all ODB revalidation requests so that we always have fresh content...
58
- // setting this header to the preview mode ID is how Next knows to revalidate
57
+ // force Next to revalidate all requests so that we always have fresh content
58
+ // for our ODBs and middleware is disabled at the origin
59
+ // but ignore in preview mode (prerender_bypass is set to true in preview mode)
60
+ // because otherwise revalidate will override preview mode
59
61
// eslint-disable-next-line no-underscore-dangle
60
- if ( headers [ 'x-nf-builder-cache' ] === 'revalidate' && ! headers . __prerender_bypass ) {
61
- console . log ( `Revalidating ${ url } ` )
62
+ if ( ! headers . __prerender_bypass ) {
63
+ // this header controls whether Next.js will revalidate the page
64
+ // and needs to be set to the preview mode id to enable it
62
65
headers [ 'x-prerender-revalidate' ] = this . renderOpts . previewProps . previewModeId
63
66
}
64
67
You can’t perform that action at this time.
0 commit comments