getStaticProps not triggered on browser back button when rewrites are used and middleware exists
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 142k
- Forks
- 32.4k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 351
Description
Link to the code that reproduces this issue
https://github.com/boreens/nextjs-rewrites
To Reproduce
- Got to https://nextjs-rewrites-ten.vercel.app/hunder
- Click on any link and then click back
https://github.com/user-attachments/assets/8c33a796-f886-4169-a965-ede3027bbe2e
Current vs. Expected behavior
When rewrites are set up in config, next link is used for navigation and middleware exist on browser back button click getStaticProps is not triggered. When middleware is deleted everything works as expected.
https://nextjs-rewrites-git-without-middleware-try-dig.vercel.app/hunder
Provide environment information
Hosted in Vercel
Which area(s) are affected? (Select all that apply)
Middleware
Which stage(s) are affected? (Select all that apply)
Vercel (Deployed)
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproduction repository at https://github.com/boreens/nextjs-rewrites and compare the deployed middleware and no-middleware URLs. Reproduce the browser back-button flow from /hunder, then inspect why getStaticProps is not triggered when rewrites, next/link navigation, and middleware are combined; done means the expected trigger occurs with middleware enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nextjs
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100