From e0c8aed5c71ffb6969fd23181607f3f883fbae61 Mon Sep 17 00:00:00 2001 From: Dreamacro <305009791@qq.com> Date: Sat, 21 Sep 2019 21:28:02 +0800 Subject: [PATCH] Fix(API): cors middleware hoisting because it doesn't work with r.Group --- hub/route/server.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hub/route/server.go b/hub/route/server.go index a1bbcde9..7736a3c9 100644 --- a/hub/route/server.go +++ b/hub/route/server.go @@ -52,9 +52,10 @@ func Start(addr string, secret string) { MaxAge: 300, }) + r.Use(cors.Handler) r.Get("/", hello) r.Group(func(r chi.Router) { - r.Use(cors.Handler, authentication) + r.Use(authentication) r.Get("/logs", getLogs) r.Get("/traffic", traffic)