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
Asked
Active
Viewed 125 times
1 Answers
0
Add this command in your azure dashboard > Configuration > Startup Command
pm2 serve /home/site/wwwroot --no-daemon --spa
and restart your server.
- This tells the host to serve the correct directory as the root directory of your site, and the
--spaflag 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.
HarshithaVeeramalla-MT
- 3,013
- 2
- 2
- 9
-
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