Config the app with base path /app.
To demonstrate the issue, a rewrite from /external to https://example.vercel.sh is added, in production, it should be another app with the same origin and a different base path.
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000
Available memory (MB): 32768
Available CPU cores: 10
Binaries:
Node: 20.11.1
npm: 10.2.4
Yarn: 1.22.19
pnpm: 9.0.6
Relevant Packages:
next: 14.3.0-canary.36 // Latest available version is detected (14.3.0-canary.36).
eslint-config-next: N/A
react: 18.3.1
react-dom: 18.3.1
typescript: 5.1.3
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Navigation, server action, base path
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), next start (local), Other (Deployed)
Additional context
The issue breaks navigation from apps routed by different base paths, such as OAuth flow. I think it's because Next.js perform redirects to same origin of the app as a client side navigation, not considering the base path.
Link to the code that reproduces this issue
https://github.com/levinqdl/reproduction-app
Config the app with base path
/app
. To demonstrate the issue, a rewrite from/external
tohttps://example.vercel.sh
is added, in production, it should be another app with the same origin and a different base path.To Reproduce
Current vs. Expected behavior
Expect:
the page is redirected to bing.com
Current:
Provide environment information
Which area(s) are affected? (Select all that apply)
Navigation, server action, base path
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), next start (local), Other (Deployed)
Additional context
The issue breaks navigation from apps routed by different base paths, such as OAuth flow. I think it's because Next.js perform redirects to same origin of the app as a client side navigation, not considering the base path.