package mw import ( "github.com/gin-contrib/cors" "github.com/gin-gonic/gin" ) func SetHandler(r *gin.Engine) { config := cors.DefaultConfig() config.AllowAllOrigins = true config.AllowCredentials = true config.AddAllowHeaders("Authorization", "X-Token") r.Use(cors.New(config)) }