Facing an issue with Next.js static exported files and with browser router-enabled React app
When I load the URL with routing, it's throwing an error.
Generally, in Vercel/Nginx, we have a configuration to solve this, and in Nginx, we add the following line to achieve it:
try_files $uri $uri.html /$uri /index.html;
I tried using Traefik middleware for the same. I attempted several configurations, but they didn’t work.
I also tried adding the above line to the nginx.conf file in the respective Docker container, and it worked properly. However, the problem is that each time we redeploy, this configuration is removed.
Any ideas on how to handle this dynamically?
7 Replies
why don't you mount the file in the container using the volumes?
you can do something like this

and that file will be persistent between any deployments
This is what I've tried for workaround but no luck

try to do
./nginx.conf
and
/etc/nginx/nginx.conf
Hey it worked just changed some thing in this try_files $uri $uri.html /$uri /index.html;
Okay you are saying to modify the main file 👍 I will try that as well.
Just a thought—what if we add an option to view and directly modify the Nginx configuration? I believe CapRover already offering that functionality.👀
yeah the thing is we don't offer native nginx since we use traefik instead of nginx