From 32b048abb4590532755d2e10d125ec72582b4de2 Mon Sep 17 00:00:00 2001 From: Jay Date: Sun, 14 Oct 2018 21:56:57 +0800 Subject: [PATCH] modify cors --- router/routes/routes.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/router/routes/routes.go b/router/routes/routes.go index 935484d..364789d 100644 --- a/router/routes/routes.go +++ b/router/routes/routes.go @@ -36,7 +36,10 @@ func NewServ() *gin.Engine { // error catch r.Use(gin.Recovery()) // enable cors - r.Use(cors.Default()) + corsConfig := cors.DefaultConfig() + corsConfig.AllowCredentials = true + corsConfig.AllowAllOrigins = true + r.Use(cors.New(corsConfig)) // session r.Use(sessions.Sessions("ginsess", store))