File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
packages/open-next/src/core/routing Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @opennextjs/aws " : patch
3+ ---
4+
5+ Fix preview mode in cache interceptor
Original file line number Diff line number Diff line change @@ -185,6 +185,17 @@ export async function cacheInterceptor(
185185 Boolean ( event . headers [ "x-prerender-revalidate" ] )
186186 )
187187 return event ;
188+
189+ // Check for Next.js preview mode cookies
190+ const cookies = event . headers . cookie || "" ;
191+ const hasPreviewData =
192+ cookies . includes ( "__prerender_bypass" ) ||
193+ cookies . includes ( "__next_preview_data" ) ;
194+
195+ if ( hasPreviewData ) {
196+ debug ( "Preview mode detected, passing through to handler" ) ;
197+ return event ;
198+ }
188199 // We localize the path in case i18n is enabled
189200 let localizedPath = localizePath ( event ) ;
190201 // If using basePath we need to remove it from the path
You can’t perform that action at this time.
0 commit comments