-
-
Notifications
You must be signed in to change notification settings - Fork 584
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
Unable to setup fallback when using parent directory in path #3242
Comments
@staniboy You can check #3108 (comment) and PR #3108, honojs/node-server#78 For workaround, you can do something like below // for client
app.get("*", serveStatic({ root: `${relative(process.cwd(), __dirname)}/../client/dist/` }));
app.get("*", serveStatic({ path: `${relative(process.cwd(), __dirname)}/client/dist/index.html` })); // fallback
// for public
app.get("*", serveStatic({ root: `${relative(process.cwd(), __dirname)}/public/` }));
app.get("*", serveStatic({ path: `${relative(process.cwd(), __dirname)}/public/index.html` })); // fallback If you use ES modules then instead of using Duplicate #2200 |
Regarding this problem, it's not an actual bug, but we have to consider to solve it. |
Related to #3420 |
This issue has been marked as stale due to inactivity. |
Closing this issue due to inactivity. |
What version of Hono are you using?
4.5.4
What runtime/platform is your app running on?
Bun
What steps can reproduce the bug?
This will serve the root from client/dist and display index.html but will fail to trigger fallback to index.html when non existing path is specified.
I've then moved my client build inside of server project folder and used:
in this case fallback worked properly.
What is the expected behavior?
Fallback path with parent directory working
What do you see instead?
Fallback path with parent directory not working
Additional information
No response
The text was updated successfully, but these errors were encountered: