In prod build, all pages (except /) return 404 when server rendered
See original GitHub issueWhen I test a prod build (next build
and next start
), server generated sub-pages return 404. This is reproducible with the next-routes example in the next repo - https://github.com/zeit/next.js/tree/master/examples/with-next-routes.
Steps to reproduce:
- Follow installation instructions (https://github.com/zeit/next.js/tree/master/examples/with-next-routes)
- Run commands
next build
followed bynext start
- Navigate to the first link
Blog: Hello world
- Refresh page and observe 404
I’m assuming this was working at some point. Maybe this was introduced in Next.js v3?
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
Next.js pages end in 404 on production build - Stack Overflow
The pages works fine in development env, but if I try to run the production build only the index.js page is loaded properly,...
Read more >How To Properly Serve 404 Errors on SPAs (with SEO in Mind)
Out of the box, 404 error pages in SPAs don't work properly, creating problems for SEO. Here we'll review the pros and cons...
Read more >Nginx: All Pages Return 404 Not Found except Home Page
I'm using Magento 2.4.4 , I've set up the existing project, but all page goes to 404 except the homepage. I'm using Nginx...
Read more >Fixing the 'cannot GET /URL' error on refresh with React ...
In this post you'll learn how to fix the 'cannot GET /URL' error with React Router. Along the way, you'll also learn how...
Read more >Dynamic Routes Details - Next.js
The paths returned from getStaticPaths will be rendered to HTML at build time. ... that have not been generated at build time will...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, you can see this in the example’s
package.json
. Thebuild
script runsNODE_ENV=production node server.js
.Oh man, thank you so much. Was wrangling with this one for a minute and driving myself nuts…Realized I had a wonky
ecosystem.config.js
usingnpm run start
instead ofyarn start