Surface better debugging information when staticwebapp.config.json not found
- Dominant language
- No language data
- Stars
- 346
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
I have a static site which requires a navigation fallback so that requests to random urls really direct back to the index page. I added a `staticwebapp.config.json` with content
```
{
"navigationFallback": {
"rewrite": "/index.html",
"exclude": [
"/img/*",
"/css/*",
"/js/*"
]
},
"responseOverrides": {
"404": {
"rewrite": "/index.html",
"statusCode": 200
}
}
}
```
Even though I am aware that the `responseOverrides` section should be unnecessary with the `navigationFallback` in place. However upon deploying I find that pages continue to give 404s when navigated to directly. This leads me to believe that the file is not making it up to the deployed site.
There does not appear to be an accessible way to query the deployed site to retrieve the current contents of the config either via the UI or CLI. Nor does there seem to be an entry in the build log as provided by the DevOps task that states if a config is found.
**Describe the solution you'd like**
They say that nobody wants a pencil sharpener, they want a sharp pencil. I want my site to work but for now I'll take a mechanism to debug what is going on with the routing entries and navigation fallback. Ideally this information would be surfaced in the UI.
**Describe alternatives you've considered**
Logging in the build would also be useful. The log entry
```
Using 'staticwebapp.config.json' file for configuration information, 'routes.json' will be ignored.
Copying 'staticwebapp.config.json' to build output
```
appears in the logs but it would be nice to have the opposite as well
````
No staticwebapp.config.json found, using defaults
````
**Additional information**
I was able to resolve my issue by moving the staticwebapp.config.json into the web application directory rather than having it in my root directory but the process to figure out what was going on was much longer than I'd like.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.