From 8321348a8f0d23da703faf5368bf994ad543fcc3 Mon Sep 17 00:00:00 2001 From: Dmitry Romanov Date: Tue, 21 May 2024 15:39:02 +0700 Subject: [PATCH] remove cors from serveBulk --- plugin/input/http/http.go | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/plugin/input/http/http.go b/plugin/input/http/http.go index 37dddc521..1beba889b 100644 --- a/plugin/input/http/http.go +++ b/plugin/input/http/http.go @@ -425,34 +425,6 @@ func (p *Plugin) ServeHTTP(w http.ResponseWriter, r *http.Request) { } func (p *Plugin) serveBulk(w http.ResponseWriter, r *http.Request, meta metadata.MetaData) { - if len(p.config.CORS.AllowedOrigins) > 0 { - // TODO: current origin - w.Header().Set( - "Access-Control-Allow-Origins", - strings.Join(p.config.CORS.AllowedOrigins, ","), - ) - } - - if len(p.config.CORS.AllowedHeaders) > 0 { - w.Header().Set( - "Access-Control-Allow-Headers", - strings.Join(p.config.CORS.AllowedHeaders, ","), - ) - } - - if len(p.config.CORS.ExposedHeaders) > 0 { - w.Header().Set( - "Access-Control-Exposed-Headers", - strings.Join(p.config.CORS.ExposedHeaders, ","), - ) - } - - w.Header().Set("Access-Control-Allow-Methods", "GET,POST,OPTIONS") - - if r.Method == http.MethodOptions { - return - } - if r.Method != http.MethodPost { http.Error(w, "", http.StatusMethodNotAllowed) return