opennextjs-netlify: Netlify's rewrite rule doesn't work with fallback pages
Describe the bug Netlify’s rewrite rule doesn’t work with fallback pages. It returns 404.
To Reproduce Steps to reproduce the behavior:
- Create next.js app with path like:
/posts/:idwithfallback: true - Set rewrite rule in
_redirectsfile/posts/:id/:slug /posts/:id 200 - Deploy to netlify
- Go to: /posts/1 -> page is rendered
- Go to: /posts/1/seo-friendly-name -> page is NOT rendered and we get 404
Expected behavior The fallback page is rendered correctly for rewrite rules.
Versions
- Next.js: 10.1.3
- plugin: 3.4.2
If you’re using file-based installation
- netlify.toml:
[build]
command = "next build"
publish = "out"
[[plugins]]
package = "@netlify/plugin-nextjs"
[context.production.environment]
NEXT_SERVERLESS = "true"
NODE_ENV = "production"
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 15
per your report, we will log a warning to users who set
revalidatein any of their pages to try to explain some of this so there are less invisible consequences to using revalidate on netlify. @surjithctly@surjithctly yes, the issue is with the revalidate setting. https://github.com/netlify/netlify-plugin-nextjs/blob/main/docs/caveats.md#incremental-static-regeneration currently we SSR all revalidate pages, which is why you weren’t seeing your prerendered files in your publish dir at first. unfortunately it’s unclear at the moment how netlify plans to address
revalidate, so i would just continue to follow there. our hope would be that, yes, the rewrite issue gets resolved whenever we add more/better support forrevalidate, but as you can see on this issue, even for fallback pages, this issue can sometimes be unavoidable.