You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Serving a Static public folder when the user has no permissions to write makes the server requests return 404.
I was testing it on a docker container, and trying to repro this locally outside docker, it only failed in the container where the permissions to write were disabled.
However if I build the docker image after testing it locally outside the container and it happens to copy the public folder that already contains the .fiber.gz files then it works fine.
It was hard to realize this was the problem because from my perspective it worked sometimes and there was no propper error message suggesting what the problem was.
How to Reproduce
Create a sample index.html inside a public folder.
Remove write permissions
chmod -R ug-w ./public
Run the CODE:
package main
import (
"encoding/json"
"log"
"time"
"github.com/gofiber/fiber/v3"
)
func main() {
var app = fiber.New(fiber.Config{
JSONEncoder: json.Marshal,
})
app.Static("/", "./public", fiber.Static{
Compress: true,
CacheDuration: 87600 * time.Hour, // refresh in 10 years.
})
app.Static("/*", "./public", fiber.Static{
Compress: true,
CacheDuration: 87600 * time.Hour, // refresh in 10 years.
})
if err := app.Listen(":3000"); err != nil {
log.Fatal(err)
}
}
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
Bug Description
Serving a Static public folder when the user has no permissions to write makes the server requests return 404.
I was testing it on a docker container, and trying to repro this locally outside docker, it only failed in the container where the permissions to write were disabled.
However if I build the docker image after testing it locally outside the container and it happens to copy the public folder that already contains the .fiber.gz files then it works fine.
It was hard to realize this was the problem because from my perspective it worked sometimes and there was no propper error message suggesting what the problem was.
How to Reproduce
chmod -R ug-w ./public
BUG: it will fail with a 404
Add write permissions:
chmod -R u w ./public
Run the code again
RESULT: It will pass now and generate all the .fiber.gz files inside public
Remove the permissions again
chmod -R u-w ./public
Run the code again
BUG: it now passes even when it can't write.
Expected Behavior
Fail with an error the tells the user that it could not write to the directory?? to the console or back to the browser with 500 and a message?
Fiber Version
3.0.0
Code Snippet (optional)
Checklist:
The text was updated successfully, but these errors were encountered: