Skip to content

Commit

Permalink
fix: add no-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
cjtim committed Aug 30, 2022
1 parent 4b1f50f commit 5528a64
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions handlers/middlewares/no_cache.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package middlewares

import "github.com/gofiber/fiber/v2"

func NoCache() func(c *fiber.Ctx) error {
return func(c *fiber.Ctx) error {
c.Set("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate")
return c.Next()
}
}
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func prepareFiber() *fiber.App {

app.Use(middlewares.Cors())
app.Use(middlewares.RequestLog())
app.Use(middlewares.NoCache())
handlers.Route(app) // setup router path
return app
}
Expand Down

0 comments on commit 5528a64

Please sign in to comment.