File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
packages/open-next/src/core/routing Expand file tree Collapse file tree 2 files changed +11
-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,9 @@ 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+ // https://github.com/opennextjs/opennextjs-aws/issues/355
260+ const url = new URL ( event . rawPath , "http://localhost" ) ;
260261
261262 if (
262263 // Someone is trying to redirect to a different origin, let's not do that
@@ -267,6 +268,9 @@ function handleTrailingSlashRedirect(
267268 ) {
268269 return false ;
269270 }
271+
272+ const emptyBody = emptyReadableStream ( ) ;
273+
270274 if (
271275 NextConfig . trailingSlash &&
272276 ! event . headers [ "x-nextjs-data" ] &&
You can’t perform that action at this time.
0 commit comments