Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http_response plugin isn't passing headers #1198

Closed
cheald opened this issue May 13, 2016 · 3 comments · Fixed by #1231
Closed

http_response plugin isn't passing headers #1198

cheald opened this issue May 13, 2016 · 3 comments · Fixed by #1231
Labels
bug unexpected problem or unintended behavior

Comments

@cheald
Copy link

cheald commented May 13, 2016

I have a Telegraf input configured as so:

[[inputs.http_response]]
  address = "http://127.0.0.1/features/"
  response_timeout = 10
  method = "GET"
  [inputs.http_response.headers]
    Host = "mydomain.com"

But headers aren't being passed. When I turn on debug logging in nginx, I see that the Host headers is 127.0.0.1, not mydomain.com as expected.

2016/05/13 23:30:20 [debug] 4877#0: *6791491 http request line: "GET /features/ HTTP/1.1"
2016/05/13 23:30:20 [debug] 4877#0: *6791491 http uri: "/features/"
2016/05/13 23:30:20 [debug] 4877#0: *6791491 http args: ""
2016/05/13 23:30:20 [debug] 4877#0: *6791491 http exten: ""
2016/05/13 23:30:20 [debug] 4877#0: *6791491 posix_memalign: 00000000020B6790:4096 @16
2016/05/13 23:30:20 [debug] 4877#0: *6791491 http process request header line
2016/05/13 23:30:20 [debug] 4877#0: *6791491 http header: "Host: 127.0.0.1"
2016/05/13 23:30:20 [debug] 4877#0: *6791491 http header: "User-Agent: Go-http-client/1.1"
2016/05/13 23:30:20 [debug] 4877#0: *6791491 http header: "Accept-Encoding: gzip"
2016/05/13 23:30:20 [debug] 4877#0: *6791491 http header done

Have I misconfigured the input, or is there an actual bug here?

@sparrc sparrc added the bug unexpected problem or unintended behavior label May 14, 2016
@sparrc
Copy link
Contributor

sparrc commented May 14, 2016

This is probably because the plugin treats the host tag specially as the Host header. I will make it so it can be overridden by user specified headers.

@sparrc
Copy link
Contributor

sparrc commented May 19, 2016

looks like this is actually a golang issue that they can't safely change for backwards-compatability reasons: golang/go#7682. We'll need to modify request.Host directly.

@cheald
Copy link
Author

cheald commented May 19, 2016

Fantastic, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants