-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for connect-history-api-fallback? #457
Comments
Hey, Douglas - it's great to see you around here! Sorry you ran into this problem; it's not documented well. I figured folks would setup nginx or build a simple one-page/route-less app. That said, I think this might be a good change for |
Ah yes, important context here — the use case for production is that the app is served from an S3 bucket, which is fronted by Varnish (any CDN would probably do here). Varnish's configuration would serve the root HTML file from any path, allowing the Router to determine which components to render. |
Ah, cool. I think this would be a good addition to |
this made it out in 0.5.3 |
Versions of kyt, node, OS
Latest!
Bug or Feature?
Feature! (Request? But also I can have a PR for this as I've done half of the work on a fork.)
Current Behavior
I started a static client-side only project created based on the kyt-starter-static starter kyt.
I'm relying on React Router for any and all navigation. Currently, when working locally (
npm run dev
) if I navigate to a page other than the root (i.e. from http://localhost:3001/ to http://localhost:3001/something), reloading the page gets a 404 as the express server can't find assets to serve from/something
.Desired Behavior
Ideally, refreshing the page on a route doesn't 404! If the Connect server started by kyt's dev action took advantage of a history api fallback middleware, this wouldn't happen.
This could take a couple of different forms, but the simplest one is to extend add a second line to this making it look like:
The middleware can also accept a variety of options; allowing those to be defined in the kyt.config.js would make them accessible here.
As I mentioned, I've done half of the work here in a fork and would be happy to contribute a PR. But also if this is possible today without making changes, then let me know!
The text was updated successfully, but these errors were encountered: