From 23644f3e16c5f5aa57da30292f7527b427f1e5f6 Mon Sep 17 00:00:00 2001 From: Jay Date: Sun, 14 Oct 2018 22:13:04 +0800 Subject: [PATCH] modify cors --- router/routes/routes.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/router/routes/routes.go b/router/routes/routes.go index 364789d..f5b7abc 100644 --- a/router/routes/routes.go +++ b/router/routes/routes.go @@ -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))