package middleware import ( "github.com/gin-contrib/cors" "github.com/gin-gonic/gin" "time" ) func CorsMiddleware(module string) gin.HandlerFunc { return cors.New(cors.Config{ AllowAllOrigins: true, //AllowOrigins: []string{"*"}, AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"}, AllowHeaders: []string{"Origin", "Content-Length", "Content-Type", "Authorization"}, AllowCredentials: false, MaxAge: 12 * time.Hour, }) }