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
Add config option to Static config to disabled cache on Index routes, use case is single page apps that need the index.html files to use no-cache, no-store, must-revalidate or add a func to the Static config that allows the header to be customized based on the file or path.
Additional Context (optional)
No response
Code Snippet (optional)
package main
import"github.com/gofiber/fiber/v2"import"log"funcmain() {
app:=fiber.New()
// custom functionapp.Static("/", "./.github", Static{CacheControl: func(c*Ctx) string {
ifstrings.HasSuffix(c.Path(), "index.html") {
return"no-cache, no-store, must-revalidate"
} else {
return""
}
}})
// or just a boolean to disable on index.html// would set the `Cache-Control` header to no-cache, no-store, must-revalidate for `index.html` filesapp.Static("/", "./.github", Static{IndexDisableCache: true}
log.Fatal(app.Listen(":3000"))
}
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
Feature Description
Add config option to Static config to disabled cache on Index routes, use case is single page apps that need the index.html files to use
no-cache, no-store, must-revalidate
or add a func to the Static config that allows the header to be customized based on the file or path.Additional Context (optional)
No response
Code Snippet (optional)
Checklist:
The text was updated successfully, but these errors were encountered: