Pages router with middleware (on vercel) - 404 results returning 200 when prefetched #72807
Labels
bug
Issue was opened via the bug report template.
create-next-app
Related to our CLI tool for quickly starting a new Next.js application.
Middleware
Related to Next.js Middleware.
Pages Router
Related to Pages Router.
Link to the code that reproduces this issue
https://github.com/magicspon/next-link-test
To Reproduce
Build and deploy the app to vercel.
Go to the URL
Click on the "Broken link" button.
Observe, the 404 page is not shown.
This only happens when running on vercel, it's fine on localhost.
It also only happens when there is middleware on the site, even though these urls aren't matched by the middleware
Current vs. Expected behavior
When clicking on a link that 404's, I would expect to see the 404 page.
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:13:04 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6020 Available memory (MB): 16384 Available CPU cores: 12 Binaries: Node: 20.17.0 npm: 10.8.2 Yarn: 1.22.19 pnpm: 8.14.0 Relevant Packages: next: 15.0.4-canary.11 // Latest available version is detected (15.0.4-canary.11). eslint-config-next: 15.0.3 react: 19.0.0-rc-7ac8e612-20241113 react-dom: 19.0.0-rc-7ac8e612-20241113 typescript: 5.6.3 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
create-next-app, Middleware, Pages Router
Which stage(s) are affected? (Select all that apply)
Vercel (Deployed)
Additional context
I've tested against the latest v14 release, the latest 15 release and the latest 15 canary release.
#57207
#56222
The text was updated successfully, but these errors were encountered: