Option to look for default files at the root of wwwroot path only, not at subpath
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
_From @NickAb on Sunday, February 28, 2016 6:26:46 AM_
`DefaultFiles` middleware allows routing to default files at request subpath if no file was found, but for angular or other single page apps we would need to always route to `/wwwroot/index.html` for any subpath, i.e.:
- `http://localhost:5000/` -> `wwwroot/index.html`
- `http://localhost:5000/some-sub-path` -> `wwwroot/index.html`
Currently we have to write custom middleware to handle this case (see [stackoverflow](http://stackoverflow.com/questions/34628536/asp-net-5-angular-2-routing-template-page-not-reloading/34643314) for example). But it seems that adding option to `DefaultFiles` to route to `wwwroot` will be a good solution for such a common case.
https://github.com/aspnet/StaticFiles/blob/dev/src/Microsoft.AspNetCore.StaticFiles/DefaultFilesMiddleware.cs#L67
_Copied from original issue: aspnet/StaticFiles#115_
Contributor guide
Assessment
This issue has not been assessed yet.