0

I have built react app using Parcel v2 and deploy it to Azure Wep App Linux service but router there is not working correctly. If you use in-app buttons and navigation it is ok, but if you try to enter any link it goes to 404 not found. Locally everything is working as expected I also tried the solutions from these questions: Deploy react js web app on linux app Service azure

React Router throwing 404 on Azure Linux Web App

B Dimitrov
  • 11
  • 4

1 Answers1

0

Add this command in your azure dashboard > Configuration > Startup Command

pm2 serve /home/site/wwwroot --no-daemon --spa

and restart your server.

enter image description here

  • This tells the host to serve the correct directory as the root directory of your site, and the --spa flag indicates that this is a single-page application so that routing is directed automatically to your root index.html file, instead of actually searching for a non-existent directory. Save this, and restart your app service.

Please refer 16th Point in Deploying a React app to Azure App Service for more details.

  • As described in the question this solution doesn’t solve the problem. The application doesn’t even start – B Dimitrov Dec 29 '21 at 13:55