Open stephanecodes opened 1 year ago
Have you checked the file is in the root of the deployment files?
Have you checked the file is in the root of the deployment files?
Hi, what file are you talking about exactly and what would be the contents of this file?
The staticwebapp.config.json
need to be deployed to the root of your application
The staticwebapp.config.json
or routes.json
(obsolete) must be deployed in the directory corresponding to the app_location
parameter of the Azure pipeline.
This is indeed the case, it is well detected but the problem is that we cannot configure several navigation callbacks, which was possible in routes.json
.
If you read my question again, that's exactly what I'm asking 😇.
Can't you just use the rewrite property for each route?
{
"routes": [
{
"route": "/angular-app-1/*",
"rewrite": "angular-app-1/index.html"
},
{
"route": "/angular-app-2/*",
"rewrite": "angular-app-2/index.html"
},
]
}
I use the same Azure Static WebApp to host multiple docs.
Each doc is an Angular application maintained by a team.
I have a pipeline that deploys every doc dist in the
docs
directory of the Azure Static WebApp :My Azure pipeline looks like this :
The
baseHref
of each Angular application varies:angular-app-1:
baseHref="/angular-app-1/"
angular-app-2:
baseHref="/angular-app-2/"
To prevent 404 error when refreshing a page, a navigation fallback to
index.html
of each Angular app is required.To achieve this, I added a
routes.json
file intodocs
directory:It works as expected but
routes.json
is deprecated since months in favor ofstaticwebapp.config.json
.Is there a way to configure a navigation fallback per Angular application with the new configuration file ?
In my case
navigationFallback.rewrite
should be :angular-app-1/index.html
forangular-app-1
angular-app-2/index.html
forangular-app-2
I have tried putting a
staticwebapp.config.json
file with the appropriate navigation fallback in each Angular application distribution, but without success.I can't figure out how to convert
routes.json
configuration tostaticwebapp.config.json