NextJS rewrite not working with SSR

I seem to have found a bug when using NextJS rewrites in combination with SSR, when also using a catch-all directory path that uses ISR.

The situation: I have a folder in my /pages directory called [...pages]/index.js. The page component in that file uses getStaticProps (in combination with getStaticPaths) to render every url using ISR. This works like expected on Netlify (and on Vercel).

For specific URLs however, I want to use SSR because I need the query params for that URL. The way I do this is by adding that specific URL as a rewrite to next.config.js (eg: /render/ssr) and rewriting that to another path that also exists in /pages (eg: /dynamic-pages/[...pages]/index.js). Locally and on Vercel this specific URL renders SSR and I have access to the context.query. On Netlify however it does seem to render the component in /dynamic-pages/[...pages]/index.js but I don’t have access to any of the query params. Also when I look in the function logs I see that the logs for this page (which should appear in “Next.js SSR Handler” logs) appear in “Next.js ISR handler” logs.

I have created a demo project that illustrates the problem, you can find the git repository here: GitHub - terrabythia/netlify-rewrite-test: Testing netlify and nextjs rewrites in combination with ISR

I have deployed the project to Netlify and Vercel (exactly the same). When you go to any url you see the (correct) page that says “rendered using ISR” (netlify:, vercel: However, when you go to the url that is defined in next.js’ rewrites, you see that the netlify version does not contain any query params ( while the vercel version does ( And again, the logs for the Netlify page that should be rendered using SSR appear in the ISR function logs.

Can anyone on the Netlify team verify that this is indeed a bug in Netlify?

update: just as a test I wanted to deploy the exact same app to another service than Vercel only (since it’s the creator of NextJS). I’ve deployed the app to, which gives me the same (correct) results as Vercel (see: and Netlify does seem to be the odd one out.

Would be great if this can be fixed on Netlify…


Thanks for sharing this information would you mind filing an issue in our repo so our devs can investigate? [Bug]: ISR Working Locally But Not Working on Netify · Issue #2127 · netlify/next-runtime · GitHub

Hi Sam,

Sure, I have created a new issue on the repo here: [Bug]: ISR in combination with nextjs rewrites not working · Issue #2129 · netlify/next-runtime · GitHub