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

inputs.prometheus - http_headers - host header ignored #15192

Closed
anthosz opened this issue Apr 19, 2024 · 6 comments · Fixed by #15195
Closed

inputs.prometheus - http_headers - host header ignored #15192

anthosz opened this issue Apr 19, 2024 · 6 comments · Fixed by #15195
Labels
bug unexpected problem or unintended behavior

Comments

@anthosz
Copy link

anthosz commented Apr 19, 2024

Relevant telegraf.conf

[[inputs.prometheus]]
  urls = ["http://127.0.0.1/metrics"]
  http_headers = {"host" = "example.org"}

Logs from Telegraf

NC

System info

telegraf 1.29, k8s 1.28

Docker

No response

Steps to reproduce

  1. telegraf --test

Expected behavior

The Host header is forwarded

Actual behavior

The Host header is not forwarded

Additional info

The goal is request the pod itself via sidecar based on a specific virtual host.

Currently, if I try curl -H 'Host: example.org' http://127.0.0.1/metrics, I can extract datas.

But with telegraf, the Host is not forwarded.
Host received from access log: localhost

@anthosz anthosz added the bug unexpected problem or unintended behavior label Apr 19, 2024
@powersj
Copy link
Contributor

powersj commented Apr 19, 2024

Hi,

The Host header is not forwarded

How are you determining that this is not occurring? Do you have a network trace demonstrating this?

The headers are set here right before any request.

@powersj powersj added the waiting for response waiting for response from contributor label Apr 19, 2024
@anthosz
Copy link
Author

anthosz commented Apr 19, 2024

Hi,

The Host header is not forwarded

How are you determining that this is not occurring? Do you have a network trace demonstrating this?

The headers are set here right before any request.

Hello,

unfortunaely not, I just tried a telegraf --test vs a curl with -H 'Host:' -> with the first one, Apache receive "localhost", second one is example.org (curl)

I tried with 127.0.0.1 & the IP of pod.

@telegraf-tiger telegraf-tiger bot removed the waiting for response waiting for response from contributor label Apr 19, 2024
powersj added a commit to powersj/telegraf that referenced this issue Apr 19, 2024
@powersj
Copy link
Contributor

powersj commented Apr 19, 2024

So after looking at this more, I remembered that the host key is a special header. I've seen this before, and sure enough: https://github.com/influxdata/telegraf/pull/14481/files

I've put up #15195 with a fix

@anthosz
Copy link
Author

anthosz commented Apr 19, 2024

Thank you very much @powersj ! So fast!

In addition, out of scope but do you know if telegraf-operator is always supported? (related to the issue: influxdata/telegraf-operator#137)

@powersj
Copy link
Contributor

powersj commented Apr 19, 2024

In addition, out of scope but do you know if telegraf-operator is always supported? (related to the issue: influxdata/telegraf-operator#137)

The individual who built and maintained that left the company last year. I don't think anyone has decided to pick it up and it is why the support statement was updated to say no official support.

If there was a specific PR that needed a review I think we might be able to convince someone to look at it who knows the operator/k8s framework better than I do 😄

@anthosz
Copy link
Author

anthosz commented Apr 19, 2024

In addition, out of scope but do you know if telegraf-operator is always supported? (related to the issue: influxdata/telegraf-operator#137)

The individual who built and maintained that left the company last year. I don't think anyone has decided to pick it up and it is why the support statement was updated to say no official support.

If there was a specific PR that needed a review I think we might be able to convince someone to look at it who knows the operator/k8s framework better than I do 😄

Thank you for the details!

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