mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 20:27:23 +00:00
Add Cache-Control header for static file serving
This commit is contained in:
@@ -33,6 +33,7 @@ func FrontendMiddleware(c fiber.Ctx) error {
|
|||||||
if _, err := os.Stat(file); path == "/" || os.IsNotExist(err) {
|
if _, err := os.Stat(file); path == "/" || os.IsNotExist(err) {
|
||||||
return serveIndexHtml(c)
|
return serveIndexHtml(c)
|
||||||
} else {
|
} else {
|
||||||
|
c.Set("Cache-Control", "public, max-age=31536000, immutable")
|
||||||
return c.SendFile(file)
|
return c.SendFile(file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user