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>(
255
255
function handleTrailingSlashRedirect (
256
256
event : InternalEvent ,
257
257
) : 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" ) ;
260
261
261
262
if (
262
263
// Someone is trying to redirect to a different origin, let's not do that
@@ -267,6 +268,9 @@ function handleTrailingSlashRedirect(
267
268
) {
268
269
return false ;
269
270
}
271
+
272
+ const emptyBody = emptyReadableStream ( ) ;
273
+
270
274
if (
271
275
NextConfig . trailingSlash &&
272
276
! event . headers [ "x-nextjs-data" ] &&
You can’t perform that action at this time.
0 commit comments