Skip to content

Commit 9406961

Browse files
reginaldosousasparrc
authored andcommitted
Fix a bug when setting host header in httpjson
closes influxdata#634
1 parent 0d391b6 commit 9406961

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

plugins/inputs/httpjson/httpjson.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,11 @@ func (h *HttpJson) sendRequest(serverURL string) (string, float64, error) {
201201

202202
// Add header parameters
203203
for k, v := range h.Headers {
204-
req.Header.Add(k, v)
204+
if strings.ToLower(k) == "host" {
205+
req.Host = v
206+
} else {
207+
req.Header.Add(k, v)
208+
}
205209
}
206210

207211
start := time.Now()

0 commit comments

Comments
 (0)