Skip to content

Additional fallback for SPA #321

Closed Answered by Kaliumhexacyanoferrat
Matasx asked this question in Q&A
Discussion options

You must be logged in to vote

Just for clarification - if /accounts/123456 ist requested - would you expect a HTTP 200 with the content of your index.html? Or a HTTP redirect to your app root? I think returning HTTP 200 will cause some irritation for clients (such as search engines).

We could add a general Fallback concern which will evaluate the inner handler and if it does not return anything return the specified content instead. This would allow to .Fallback() on any handler, and also to specify multiple fallbacks if needed. In your case this then could be:

var httpContent = Layout.Create()
                        .Add("api", api)
                        .Fallback(SinglePageApplication.From(ResourceTree.FromDirecto…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Kaliumhexacyanoferrat
Comment options

@Matasx
Comment options

Matasx Oct 13, 2022
Collaborator Author

Answer selected by Matasx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants