I'm trying to deploy my Angular app to the Azure static websites. I configured the environment following this tutorial: Medium tutorial for Azure static websites
The problem that I have is the fallback in the case I try to access for example myurl.com/mypage (with only myurl.com is working correctly).
I'm building Angular with ng build --prod.
As it's running on IIS, I've tried the following web.config: web.config, I put it in /src folder and I've changed angular.json as follows:
"assets": [
     ...
     "src/web.config"
],
and it's placing the file in the root folder which is correct.
My problem is that I'm still getting 404 when I try to access myurl.com/mypage
You can specify your fallback route by creating a file called routes.json in src/assets. It should contain:
{
  "routes": [
    {
      "route": "/*",
      "serve": "/index.html",
      "statusCode": 200
    }
  ]
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With