Skip to content

Commit

Permalink
remove cors from serveBulk
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryRomanov committed May 23, 2024
1 parent 2a2e16e commit 8321348
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions plugin/input/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8321348

Please sign in to comment.