Add FallbackToFile options for serving apps with client-side routing.
See original GitHub issueI have a react+typescript app use the React BrowserRouter
.
For example, if I used React Router with a route for /todos
, dotnet-serve
will response a HTTP 404 .
This is because when there is a fresh page load for a /todos
, the dotnet-server
looks for the file build/todos{.html/htm} and does not find it. The dotnet-server
should to be configured to respond to a request to /todos
by serving index.html.
Describe the solution you’d like
Add options to configure FallbackToFile(...)
endpoints. Such as :
dotnet serve --fallback-to-file "index.html"
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Handling SPA Fallback Paths in a Generic ASP.NET Core ...
In this post I deal with another application specific scenario: Handling client side routed URL handling when the client side routes fall ...
Read more >Add a fallback page with client routing for "export" #33532
I've got a nextjs app which I build and export. This produces a set of html files I can easily serve with a...
Read more >Configure Azure Static Web Apps
Routing rules can only secure HTTP requests to routes that are served from Static Web Apps. Many front-end frameworks use client-side routing ......
Read more >How to client-side-routing with create-react-app
Everything is working fine, but the routing is not client-side and there is no webpack.config.js file. I understand CSR works by serving index....
Read more >Web app routing with fallback
Imagine we have a web page with client-side routing. For different urls we will show different pages. For example, using HyperApp Routing we ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ok, I see what you are saying now. It sounds like you want all unknown routes to redirect to some default file. This behavior doesn’t seem to me to be like a common use case. I don’t plan to implement this, but I will leave this request open in case I am missing something.
Other users - please upvote if you want support for this feature request.
Released in https://github.com/natemcmaster/dotnet-serve/releases/tag/v1.10.155