You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
284 B
15 lines
284 B
4 months ago
|
package mw
|
||
|
|
||
|
import (
|
||
|
"github.com/gin-contrib/cors"
|
||
|
"github.com/gin-gonic/gin"
|
||
|
)
|
||
|
|
||
|
func Cors(r *gin.Engine) {
|
||
|
config := cors.DefaultConfig()
|
||
|
config.AllowAllOrigins = true
|
||
|
config.AllowCredentials = true
|
||
|
config.AddAllowHeaders("Authorization", "X-Token")
|
||
|
r.Use(cors.New(config))
|
||
|
}
|