Skip to content

Commit

Permalink
fix(inputs.prometheus): Correctly handle host header (#15195)
Browse files Browse the repository at this point in the history
  • Loading branch information
powersj authored Apr 19, 2024
1 parent f5d393c commit 6bb3d32
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion plugins/inputs/prometheus/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,11 @@ func (p *Prometheus) gatherURL(u URLAndAddress, acc telegraf.Accumulator) (map[s
}

for key, value := range p.HTTPHeaders {
req.Header.Set(key, value)
if strings.EqualFold(key, "host") {
req.Host = value
} else {
req.Header.Set(key, value)
}
}

var err error
Expand Down

0 comments on commit 6bb3d32

Please sign in to comment.