-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
🐛 [Bug]: Static server in sub app does not work #3104
Comments
Thanks for opening your first issue here! 🎉 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord |
thx for sharing, which version do you use? |
@ReneWerner87 I am using fiber v2.52.5 with go 1.23.0
|
Line 404 in 6e74114
@ReneWerner87 I found that when using mount , although the expected path of fs.root is correct, the result of fasthttp ctx.Path is '/' and '/public', which causes the access path to change from public to public/public , which is the reason for this bug.
fs := &fasthttp.FS{
Root: root, https://github.com/valyala/fasthttp/blob/c3050516d957b5bf75b353683c50302e4f955c6b/fs.go#L1074 // expect: ctx.Path ="/" filepath = "E:\projects_go\server\public"
// fact: ctx.Path = "/public" filepath = "E:\projects_go\server\public\public"
ff, err = h.openFSFile(filePath, mustCompress, fileEncoding) |
Same issue for me. So I submit a PR. |
Question Description
I am trying to set app a static server in a sub app, but it does not seem to work.
The problem can be reproduced with the snippet below.
Project struture:
Tests:
Code Snippet (optional)
Checklist:
The text was updated successfully, but these errors were encountered: