You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected: page is displayed and the address bar in the browser reads /destination, not /prefix/destination
Current: page is displayed and the address bar in the browser reads /prefix/destination, not /destination
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:37 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6031
Available memory (MB): 65536
Available CPU cores: 16
Binaries:
Node: 20.11.1
npm: 10.2.4
Yarn: 1.22.22
pnpm: 8.15.5
Relevant Packages:
next: 14.2.3 // Latest available version is detected (14.2.3).
eslint-config-next: 14.2.3
react: 18.3.0
react-dom: 18.3.0
typescript: 5.4.5
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Pages Router
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), next start (local), Vercel (Deployed), Other (Deployed)
Additional context
I tested latest canary release 14.3.0-canary.23 and the bug is still present there. It's been happening for months. What's interesting is that this seems to be a client-side triggered redirect because the server returns HTTP 200 initially and the path changes in the browser right after. I've also tried writing a middleware to handle the rewrite instead of using rewrites in the config and it's still happening - likely a bug in the client side routing code. Here's the middleware I tried:
Link to the code that reproduces this issue
https://github.com/mareksuscak/router-bug/blob/main/next.config.mjs#L5-L18
To Reproduce
Current vs. Expected behavior
Expected: page is displayed and the address bar in the browser reads
/destination
, not/prefix/destination
Current: page is displayed and the address bar in the browser reads
/prefix/destination
, not/destination
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:37 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6031 Available memory (MB): 65536 Available CPU cores: 16 Binaries: Node: 20.11.1 npm: 10.2.4 Yarn: 1.22.22 pnpm: 8.15.5 Relevant Packages: next: 14.2.3 // Latest available version is detected (14.2.3). eslint-config-next: 14.2.3 react: 18.3.0 react-dom: 18.3.0 typescript: 5.4.5 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Pages Router
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), next start (local), Vercel (Deployed), Other (Deployed)
Additional context
I tested latest canary release 14.3.0-canary.23 and the bug is still present there. It's been happening for months. What's interesting is that this seems to be a client-side triggered redirect because the server returns HTTP 200 initially and the path changes in the browser right after. I've also tried writing a middleware to handle the rewrite instead of using
rewrites
in the config and it's still happening - likely a bug in the client side routing code. Here's the middleware I tried:The text was updated successfully, but these errors were encountered: