From 94069611256fc0d08729d186f8a118e396f80720 Mon Sep 17 00:00:00 2001
From: Reginaldo Sousa <reginaldo.rms@gmail.com>
Date: Tue, 2 Feb 2016 17:22:15 -0200
Subject: [PATCH] Fix a bug when setting host header in httpjson

closes #634
---
 plugins/inputs/httpjson/httpjson.go | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/plugins/inputs/httpjson/httpjson.go b/plugins/inputs/httpjson/httpjson.go
index ee5e296d..3070e633 100644
--- a/plugins/inputs/httpjson/httpjson.go
+++ b/plugins/inputs/httpjson/httpjson.go
@@ -201,7 +201,11 @@ func (h *HttpJson) sendRequest(serverURL string) (string, float64, error) {
 
 	// Add header parameters
 	for k, v := range h.Headers {
-		req.Header.Add(k, v)
+		if strings.ToLower(k) == "host" {
+			req.Host = v
+		} else {
+			req.Header.Add(k, v)
+		}
 	}
 
 	start := time.Now()
-- 
GitLab