How to fix new 404 error for static web app

Tim Northrop 0 Reputation points
2024-10-24T16:04:04.7633333+00:00

Hi everyone, I'm new to Azure so this might be a dumb question. I have a very simple static web app that's been up and functioning as expected for over a year, but I've just started getting 404 errors from Azure when visiting the domain. I didn't make any changes to start this issue, and the app is quite literally just index.html and styles.css.

I'm using Azure for Students, and my project is under my school's subscription. Is it possible that my resource got moved around somehow?

I haven't taken any actions besides troubleshooting through Azure, although that doesn't report any problems. Should I just push a change to the repo to kick off another deployment?

Thanks in advance!

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,173 questions
{count} votes

1 answer

Sort by: Most helpful
  1. SnehaAgrawal-MSFT 22,706 Reputation points Moderator
    2024-11-04T11:31:07.63+00:00

    @Tim Northrop Aplogies for late response here! If you are still facing this issue you may want to know that the recommended way of dealing with SPA is to use the staticwebapp.config.json file with the following content:

    {
      "navigationFallback": {
        "rewrite": "index.html",
        "exclude": ["/*.{     ADD_FILE_EXTENSIONS_HERE    }"]
      }
    }
    

    See an example for Angular: https://github.com/manekinekko/azure-static-web-apps-playground/blob/main/src/assets/staticwebapp.config.json

    Refrence- https://docs.microsoft.com/en-us/azure/static-web-apps/configuration#fallback-routes

    0 comments No comments

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.