generateStaticParams for dynamic route handlers
Answered
West African Crocodile posted this in #help-forum
West African CrocodileOP
I have to utilize nextjs as a reverse proxy for my content pages, but cannot use edge runtime (middleware) -> cannot use nextjs native rewrites. Now i am using a catch-all route handler that fetches my landing page for example and provides the html back as a rewritten response.
Since this is a dynamic route handler, static rendering / caching does not really work here. It would be helpful to statically cache these route handlers for certain paths during build, with the same mechanic that is being used on dynamic page route segments: generateStaticPaths
Since this is a dynamic route handler, static rendering / caching does not really work here. It would be helpful to statically cache these route handlers for certain paths during build, with the same mechanic that is being used on dynamic page route segments: generateStaticPaths
Answered by joulev
uhm you are asking for
generateStaticParams
for route.ts
files right? that should already work though, im using that in prod5 Replies
Asian black bear
You should direct your feature request to the official repository: https://github.com/vercel/next.js/discussions/new?category=ideas
@West African Crocodile I have to utilize nextjs as a reverse proxy for my content pages, but cannot use edge runtime (middleware) -> cannot use nextjs native rewrites. Now i am using a catch-all route handler that fetches my landing page for example and provides the html back as a rewritten response.
Since this is a dynamic route handler, static rendering / caching does not really work here. It would be helpful to statically cache these route handlers for certain paths during build, with the same mechanic that is being used on dynamic page route segments: generateStaticPaths
uhm you are asking for
generateStaticParams
for route.ts
files right? that should already work though, im using that in prodAnswer
@joulev uhm you are asking for `generateStaticParams` for `route.ts` files right? that should already work though, im using that in prod
West African CrocodileOP
yes, i messed up the naming, thanks. i will try
West African CrocodileOP
it works, thanks for letting me know! @joulev
you're welcome