modify cors

This commit is contained in:
Jay 2018-10-14 22:13:04 +08:00
parent df15a041a5
commit 23644f3e16

View File

@ -38,7 +38,11 @@ func NewServ() *gin.Engine {
// enable cors
corsConfig := cors.DefaultConfig()
corsConfig.AllowCredentials = true
corsConfig.AllowAllOrigins = true
corsConfig.AllowOrigins = []string{
"http://localhost:8080",
"http://localhost:8081",
"https://bot.trj.tw",
}
r.Use(cors.New(corsConfig))
// session
r.Use(sessions.Sessions("ginsess", store))