question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add FallbackToFile options for serving apps with client-side routing.

See original GitHub issue

I 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:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
natemcmastercommented, Nov 29, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found