SPA fallback not working for Angular static site with AddViteApp + PublishAsStaticWebsite (minimal reproduction included)
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Describe the bug
When using builder.AddViteApp(...).PublishAsStaticWebsite(...) to host an Angular app, direct root access works and redirects to /test as expected. However, when you refresh a page at /test or navigate directly to it, a 404 error is returned. This happens because the YARP reverse proxy container does not have proper fallback configuration to route SPA routes (like /test) to index.html, so Angular routing is bypassed.
### Expected Behavior
When a user visits or refreshes any route in the Angular SPA (such as /test), index.html should be served and routing should be handled internally by Angular—no 404 errors.
### Steps To Reproduce
1. Clone the minimal reproduction repo: https://github.com/cdbrown2018/aspire-angular-demo
2. Run the solution per its README/setup
3. Open the Angular app at its base URL—the initial request succeeds and redirects to /test.
4. Refresh the browser at /test or directly visit /test in a new tab.
5. Observe the 404 returned (should serve index.html instead).
### Exceptions (if any)
404 Not Found returned by YARP container when accessing /test directly.
### Aspire doctor output
_No response_
### Anything else?
- .NET 8+
- Angular 21+, Vite, AddViteApp API
- Minimal repro repo: https://github.com/cdbrown2018/aspire-angular-demo
Contributor guide
Assessment
This issue has not been assessed yet.