Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pages router with middleware (on vercel) - 404 results returning 200 when prefetched #72807

Open
magicspon opened this issue Nov 14, 2024 · 0 comments
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.

Comments

@magicspon
Copy link

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

@magicspon magicspon added the bug Issue was opened via the bug report template. label Nov 14, 2024
@github-actions github-actions bot added 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. labels Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

1 participant