gofiber / fiber

⚡️ Express inspired web framework written in Go
https://gofiber.io
MIT License
33.85k stars 1.66k forks source link

🐛 [Bug]: Caching static assets #3188

Open lorypelli opened 5 hours ago

lorypelli commented 5 hours ago

Bug Description

The browser cache assets and I don't know how to fix

How to Reproduce

Create server with a static directory

Expected Behavior

To prevent caching I added a t url query param that contains the current unix seconds time

Fiber Version

2.52.5

Code Snippet (optional)

No response

Checklist:

lorypelli commented 5 hours ago

Is there a better way to fix?

gaby commented 31 minutes ago

@lorypelli This is explained in the docs: https://docs.gofiber.io/api/app/#static

// Custom config
app.Static("/", "./public", fiber.Static{
  CacheDuration: -1,
})