App Service 404 error on any page but hostingstart.html

Joe H 96 Reputation points
2023-04-24T18:50:32.6333333+00:00

I've set up a B1 App Service running Linux, custom domain, cert, etc. When I go to https://myapp.mydomain.com/hostingstart.html, the page comes up fine. However, when I go to any other page I've uploaded to the wwwroot folder, I get a 404 error. Thinking it was something to do with the file, I tried downloading hostingstart.html and re-uploading it as hostingstart1.html, but get a 404. I've verified that the files exist via both FileZilla and Kudu, and I know I'm typing the names and case correctly. I'm more familiar with Windows based App Services than Linux, so what am I missing here?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2023-04-25T07:58:19.21+00:00

    @Joe H , From your issue description, I understand you are experiencing a 404 error when trying to access pages other than hostingstart.html on your B1 App Service running Linux.  

    Just to clarify, is there any sub status code associated with the response code e.g. 404.1 or 404.2

    • What is your application framework/language?  Check that the static assets returning a 404/missing are in /public
    • Review if the URL/page is only related to static content.
    • This could be due to a few reasons, kindly try the following steps to isolate the issue ( if you haven’t done already so):

    1.It sounds like there might be an issue with the routing configuration of your App Service. You can try checking the routing rules to ensure that they are correctly configured to route traffic to the appropriate pages.

    • Please review the application code or configuration for the specific route that matches the URL

    2.You may leverage App Service diagnostics from Azure Portal

    • Navigate to your App Service app in the Azure Portal.
    • In the left navigation, click on Diagnose and solve problems - Review - “Configuration and Management and “Availability and Performance”  options.

    3.You may also check the logs to see if there are any errors or issues that might be causing the 404 errors. To do this, you may enable logging in your App Service and then view the logs in the Azure portal. Here is a link to the Azure documentation on how to enable logging for your App Service.

    ----- 4.If it’s Node/js framework:

    If the application is a SPA (Single Page Application), you may add
     --spa argument to PM2 as follows and review  process.json file for the directory path.
    pm2 serve /home/site/wwwroot/build --no-daemon –spa Checkout this doc -to serve the built content : Running Production Build Nodejs Apps on App Service Linux

    • Kindly let us know, I'll be more than happy to assist you further.
    0 comments No comments

  2. Joe H 96 Reputation points
    2023-04-25T14:44:16.54+00:00
    1. What is your application framework/language
      1. .NET 7 STS, however this site will just serve pages with static content.
      2. I'm not sure where /public is. My files are located in wwwroot.
    2. Review if the URL/page is only related to static content
      1. It is static content.
    3. It sounds like there might be an issue with the routing configuration of your App Service
      1. This App Service is Internet only. It does not connect to any vNets.
    4. Logging 1- In the HTTP logs, all I see is the 404 error. It doesn't make sense to me why this isn't working. I can access hostingstart.html just file, but if download and then upload a copy of that file, named hostingstart1.html, and try to access it, I get a 404. It almost seems like a file permission issue, but it doesn't explain why I can access one file in wwwroot, and the other in the same folder gives a 404.

Your answer

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