Skip to content

Commit d40c54c

Browse files
fix: server side redirects causd by default search param respect rewrite
fixes #5477
1 parent bfc54dd commit d40c54c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎packages/router-core/src/router.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,6 @@ export class RouterCore<
11621162
maskedLocation: location,
11631163
}
11641164
}
1165-
11661165
return location
11671166
}
11681167

@@ -1966,7 +1965,12 @@ export class RouterCore<
19661965
trimPath(normalizeUrl(this.latestLocation.href)) !==
19671966
trimPath(normalizeUrl(nextLocation.href))
19681967
) {
1969-
throw redirect({ href: nextLocation.href })
1968+
let href = nextLocation.url
1969+
if (this.origin && href.startsWith(this.origin)) {
1970+
href = href.replace(this.origin, '') || '/'
1971+
}
1972+
1973+
throw redirect({ href })
19701974
}
19711975
}
19721976

0 commit comments

Comments
 (0)