Hi I uploaded my react app on server and make it live. It's working fine but whenever I refresh any page of application. it's returning 404 error. what should I do ?
When your app load. The react-router handle Router. The Route change is handled by Router itself but on refreshing the request goes to nginx where that specific route doesn't exist.
To resolve this issue you need to load root file. try this solution.
cd /etc/nginx/sites-available
sudo nano default
in default file update location
location {
try_files $uri /index.html;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With