Skip to content

chrilis/next-standalone-rewrite

Repository files navigation

Next.js Standalone Rewrites including index

This repo reproduces a strange behaviour of the Next.js standalone mode. Rewrites with destination /index/ do not work as expected, however rewrites with other destinations (e.g. /test/) do work.

The same behavior occurs in combination with a middleware.js file. The rewrite is executed but the query param is not set (/test-middleware/ should redirect to /index/ too).

Expected behaviour

  • / should rewrite to /index/ and the query params should be set accordingly.
  • /test-middleware should rewrite to /index/ and the query params should be set accordingly.

Actual behaviour

  • npm run dev or npm run build && npm run start: The rewrite works: The query params for slug are set correctly.
  • npm run build && cp -r public .next/standalone && cp -r .next/static .next/standalone/.next && node .next/standalone/server.js: The rewrite does not work, the query param for slug does not exist.

Steps to reproduce

{
 "query": {
   "slug": [
     "index"
   ]
 },
 "resolvedUrl": "/index"
}
{
 "query": {
   "slug": [
     "index"
   ]
 },
 "resolvedUrl": "/index"
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published