From b9706815b3bd9ef70a13a7d92a12cbd0461b8a02 Mon Sep 17 00:00:00 2001 From: rht Date: Tue, 1 Dec 2015 18:44:17 +0700 Subject: [PATCH] Fix SetAllowedOrigins License: MIT Signed-off-by: rht --- commands/http/handler.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/commands/http/handler.go b/commands/http/handler.go index 9f43e4d6e..5679cd6e7 100644 --- a/commands/http/handler.go +++ b/commands/http/handler.go @@ -332,7 +332,9 @@ func (cfg ServerConfig) AllowedOrigins() []string { func (cfg *ServerConfig) SetAllowedOrigins(origins ...string) { cfg.cORSOptsRWMutex.Lock() defer cfg.cORSOptsRWMutex.Unlock() - cfg.cORSOpts.AllowedOrigins = origins + o := make([]string, len(origins)) + copy(o, origins) + cfg.cORSOpts.AllowedOrigins = o } func (cfg *ServerConfig) AppendAllowedOrigins(origins ...string) {