modify cors

This commit is contained in:
Jay 2018-10-14 21:56:57 +08:00
parent ffd6d516cc
commit 32b048abb4

View File

@ -36,7 +36,10 @@ func NewServ() *gin.Engine {
// error catch // error catch
r.Use(gin.Recovery()) r.Use(gin.Recovery())
// enable cors // enable cors
r.Use(cors.Default()) corsConfig := cors.DefaultConfig()
corsConfig.AllowCredentials = true
corsConfig.AllowAllOrigins = true
r.Use(cors.New(corsConfig))
// session // session
r.Use(sessions.Sessions("ginsess", store)) r.Use(sessions.Sessions("ginsess", store))