next.js: 404 error when using useFileSystemPublicRoutes = false

When useFileSystemPublicRoutes is set to false and there is no custom route for path, but page-based route exists, nextjs will render that page on client instead of 404.

Steps to reproduce:

  1. Take custom-server example
  2. Replace const app = next({ dev }) in server.js with const app = next({ dev, conf: { useFileSystemPublicRoutes: false } })
  3. There’s now no route for /
  4. Start the server, hit localhost:3000
  5. Server serves 404 (it flashes for a moment), then client takes over and re-renders /pages/index.js component. Browser console contains Warning: React attempted to reuse markup

So with this option behavior on server and client is not consistent, and it doesn’t look like it should work this way.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 12
  • Comments: 24 (17 by maintainers)

Most upvoted comments

also seeing the same problem, any updates on this issue? thanks