Hi Piotr Piątkiewicz ,
Welcome to the Microsoft Q&A Platform!
The issue due to because Azure Storage static websites do not support client-side routing out of the box. When you click a link that routes to a path like /car/eleanor
, the browser requests that specific path from the server. However, the server looks for a physical file at that path and returns a 404 error because no such file exists.
So you need to Redirect All Routes to index.html
- Configure Azure Storage Static Website for Routing.
- Go to the Azure Storage account.
- Under Static website settings, set>Index document name
index.html>
Error document pathindex.html.
- This ensures any non-existent paths are redirected to
index.html
, enabling client-side routing. - Add a
web.config
File >Place the followingweb.config
in the root of yourbuild
folder.<configuration> <system.webServer> <rewrite> <rules> <rule name="React Routes" stopProcessing="true"> <match url=".*" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.html" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
- For AFD Configure a rewrite rule to redirect 404 errors to
index.html
https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-static-website
If the answer is helpful, please click "Accept Answer" and kindly upvote it.