azureazure-blob-storageazure-static-web-app

"The requested content does not exist" on routes other than / - React app as Static Website


The React app I created works fine locally. Then I created a storage account, enabled static website, and deployed build folder to $web. And it works on first sight, but when I click anything that goes to another route, like /car/eleanor it shows the error "The requested content does not exist."

The requested content does not exist error screenshot

Copilot told me to create web.config or staticwebapp config.json and put it in public catalog, but it doesn't work, same error.

I'm accessing the page at storage account address at ...z36.web.core.windows.net, didn't configure CDN/FrontDoor. I mean I configured, but it shows the same error from AFD url.

I found in another post on SO a comment with an advice to set index.html as error endpoint, but it doesn't sound like the right approach.

Edit: I found that access level for $web should not be "private" like I had. I just changed it to "Blob" or "Container", but it's still the same.

Edit2: Storage Acccount settings:

enter image description here

enter image description here

enter image description here

Edit3: I disabled the static website, then enabled again and for few seconds the error appeared even on the main page, but then the problem is the same, only main page works.

Does anyone know what's going on?


Solution

  • when I click anything that goes to another route, like /car/eleanor it shows the error "The requested content does not exist."

    According to this MS-Document,

    Solution with setting index.html as Error Page works, but would be helpful to see some explanation

    So that why setting Index.html as Error Page works same like yours in my environment.

    In my environment, I tried with sample with my path is sample/test and with one jpg file.

    Portal: enter image description here