DokployD
Dokploy16mo ago
9 replies
ksanjeeb

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?
Screenshot_2024-10-15_014830.png
Was this page helpful?