File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
packages/open-next/src/core/routing Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @opennextjs/aws " : patch
3+ ---
4+
5+ fix(cloudflare): enable trailiing slash redirect
Original file line number Diff line number Diff line change @@ -255,8 +255,8 @@ export function handleRewrites<T extends RewriteDefinition>(
255255function handleTrailingSlashRedirect (
256256 event : InternalEvent ,
257257) : false | InternalResult {
258- const url = new URL ( event . url , "http://localhost" ) ;
259- const emptyBody = emptyReadableStream ( ) ;
258+ // When rawPath is `//domain`, `url.host` would be `domain`.
259+ const url = new URL ( event . rawPath , "http://localhost" ) ;
260260
261261 if (
262262 // Someone is trying to redirect to a different origin, let's not do that
@@ -267,6 +267,9 @@ function handleTrailingSlashRedirect(
267267 ) {
268268 return false ;
269269 }
270+
271+ const emptyBody = emptyReadableStream ( ) ;
272+
270273 if (
271274 NextConfig . trailingSlash &&
272275 ! event . headers [ "x-nextjs-data" ] &&
You can’t perform that action at this time.
0 commit comments