Share via

Azure App Service returning 404 after deployment from GitHub (React/Vite build

Suresh Pathuri 0 Reputation points
2026-01-13T10:01:13.17+00:00

Hi everyone, I’m facing an issue after deploying my web app to Azure App Service.

Problem:

I deployed a React (Vite) web app to Azure App Service using GitHub Actions. The deployment completes successfully, but when I open the site I immediately get a 404 Not Found page from Azure.

Sometimes the site loads for a moment and then switches back to 404.

Environment:

Framework: React (Vite)

Hosting: Azure App Service (Linux)

Deployment: GitHub Actions

Build command: npm install + npm run build

What I’ve verified so far:

GitHub build logs show success

site/wwwroot contains build output

Startup command not configured (default)

App Service logs don’t show fatal errors

Questions:

Why would Azure return 404 after a successful deployment?

Do I need a custom startup command for Vite apps on App Service?

Where should the built files be located for static serving?

Is there additional configuration needed (web.config, nginx, startup script, etc.)?

Extra Info / Suspicions:

It seems the 404 might be coming from Azure’s default landing page or missing static server routing configuration.

I also read that Vite builds may need:

  • /build output moved to /wwwroot

web.config for SPA routing (if Windows)

staticwebapp.config.json (if Azure Static Web App)

Hi everyone, I’m facing an issue after deploying my web app to Azure App Service.

Problem:

I deployed a React (Vite) web app to Azure App Service using GitHub Actions. The deployment completes successfully, but when I open the site I immediately get a 404 Not Found page from Azure.

Sometimes the site loads for a moment and then switches back to 404.

Environment:

Framework: React (Vite)

Hosting: Azure App Service (Linux)

Deployment: GitHub Actions

Build command: npm install + npm run build

What I’ve verified so far:

GitHub build logs show success

site/wwwroot contains build output

Startup command not configured (default)

App Service logs don’t show fatal errors

Questions:

Why would Azure return 404 after a successful deployment?

Do I need a custom startup command for Vite apps on App Service?

Where should the built files be located for static serving?

Is there additional configuration needed (web.config, nginx, startup script, etc.)?

Extra Info / Suspicions:

It seems the 404 might be coming from Azure’s default landing page or missing static server routing configuration.

I also read that Vite builds may need:

/build output moved to /wwwroot

web.config for SPA routing (if Windows)

  • staticwebapp.config.json (if Azure Static Web App)Screenshot 2026-01-13 at 09.59.41

Azure App Service
Azure App Service

Azure App Service is a service used to create and deploy scalable, mission-critical web apps.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Shree Hima Bindu Maganti 7,580 Reputation points Microsoft External Staff Moderator
    2026-01-19T16:11:38.88+00:00

    Hi @Suresh Pathuri
    It seems you're getting a 404 error after deploying your React (Vite) app to Azure App Service.

    Vite apps may need a specific startup command in the App Service configuration to serve static files correctly.

    Make sure the built files from Vite (typically in the /build folder) are placed in /home/site/wwwroot. Move them if necessary.

    For apps with client-side routing, Azure might require a web.config file for proper SPA routing, especially on Windows hosting.

    Check your App Service logs for any errors or warnings that could point to the issue.
    If needed, specify a custom startup command for Vite in the Azure portal as per the documentation.

    Review your GitHub Actions workflow to confirm it's building the project and deploying to the correct path.

    Look at the deployment logs in the Actions tab on GitHub for any unusual activity.
    https://learn.microsoft.com/en-us/azure/static-web-apps/troubleshooting
    https://github.com/projectkudu/kudu/wiki
    https://learn.microsoft.com/en-us/azure/static-web-apps/database-configuration
    Let me know if you have any further assistances needed.

    Was this answer helpful?

    0 comments No comments

  2. Michele Ariis 7,215 Reputation points MVP Volunteer Moderator
    2026-01-14T08:17:10.89+00:00

    Hi, you are getting the Azure 404 because App Service is not actually serving your Vite build. The deployment succeeds, but what ends up under /home/site/wwwroot is not a static site that the container can serve at /.

    For a React/Vite app on Linux App Service you do not need a Node server, but you must make sure that:

    -npm run build produces a dist folder.

    -Your GitHub Action copies the contents of dist into site/wwwroot (so /home/site/wwwroot/index.html exists). Do not deploy the whole repo, only the build output.

    -Optionally set a startup command such as:

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

    so the container always serves your static files and SPA routes.

    If index.html is not at the root of wwwroot, or the app is listening on no port because there is no server, App Service falls back to its own 404 page, which is exactly what you are seeing.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.