I'm having some issues with preview. When working locally, it works flawless, but I get a 404(my 404 page) in production, and the page reloads continuously.
I checked the application and the preview cookie is there but I noticed that in the build folder, there is no "api" directory with preview.js and exit-preview.js.
Here are some more details:
- next: 12.0.10
- NGINX and docker
If you need more details, I'm here
Thank you in advance!
Welcome to the community!
This sounds like an issue with deploying Next.js
api routes using NGINX and docker. There's a similar issue when using Netlify to deploy Next.js projects.
This is why it's recommended to deploy Next.js apps with Vercel, because as they state when deploying with Vercel:
API Routes are automatically optimized as isolated Serverless Functions that can scale infinitely
Hope this helps.
Instead of using NGINX, we followed the Next.js deployment docs you shared with me and used node in docker.
Thank you for the prompt answer!
Have a great day