diff --git a/backend/pkg/web/middleware/cache.go b/backend/pkg/web/middleware/cache.go new file mode 100644 index 000000000..5157a7153 --- /dev/null +++ b/backend/pkg/web/middleware/cache.go @@ -0,0 +1,11 @@ +package middleware + +import "github.com/gin-gonic/gin" + +func CacheMiddleware() gin.HandlerFunc { + return func(c *gin.Context) { + c.Writer.Header().Set("Cache-Control", "no-cache") + c.Writer.Header().Set("Pragma", "no-cache") + c.Next() + } +} diff --git a/backend/pkg/web/server.go b/backend/pkg/web/server.go index aa3669560..8847272b0 100644 --- a/backend/pkg/web/server.go +++ b/backend/pkg/web/server.go @@ -37,6 +37,7 @@ func (ae *AppEngine) Setup() (*gin.RouterGroup, *gin.Engine) { { api := base.Group("/api") { + api.Use(middleware.CacheMiddleware()) api.GET("/health", func(c *gin.Context) { //TODO: // check if the /web folder is populated.