NextJs Rewrites, SSGed pages are built again when accessed #1251
Replies: 2 comments
-
Hi @RaphaelGimenez! |
Beta Was this translation helpful? Give feedback.
-
Hey @ascorbic! Thanks for the help 🙇 ! I've tried quite a few things since yesterday and I now have two almost solutions. The first, the easier, is using only Netlify rewrites. Here are what they looks like:
This works but make the app reload since Netlify has to do the rewrite? The other one is a mix of duplicating the template to an
|
Beta Was this translation helpful? Give feedback.
-
Hello 👋
I'm having trouble understanding some behaviors of NextJs rewrites.
For context:
I have a shopping page situated in
pages/boutique/page/[page].jsx
. On build, I statically generate every shopping page for pagination.Then I use NextJs rewrites to access the shop pages from
/boutique
,/boutique?page=2
...Here are the rewrites:
Everything works on local.
But when on netlify if I try to access directly
domain.com/boutique
, the page is SSRed through the ___netlify-handler function and is build again from the ground up. Why isn't it taking the already generated data from the build process ?To note that when on netlify if I access the shop page from the home page everything works fine because NextJs fetch the
_next/data/rLzS2FNycK4svgL2EMf5y/boutique/page/1.json
data and the js bundle for the page.I don't understand why this is happening and would appreciate some help.
Thanks to everyone working on this project 👏
Have a good day
Beta Was this translation helpful? Give feedback.
All reactions