-
Notifications
You must be signed in to change notification settings - Fork 9.7k
http client config: Allow overwriting Host Header #13157
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
Conversation
Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
ca746c3
to
0377b56
Compare
I think that code will never be reached because of: Lines 43 to 47 in f997c72
Prometheus does not accept setting such header in the configuration: Lines 1031 to 1047 in f997c72
Have you tried |
Ah. I see. I'm coming from https://github.com/grafana/agent which is using the prometheus libaries without the config validations. I did not tried proxy_url. I expect with proxy, the HTTP CONNECT will be used to etablish an https connection over an proxy with is not supported by prometheus. In my case, there is no proxy between client and server. @machine424 What did you think about removing the host header from the |
I don't fully understand what you're trying to achieve by setting Regarding |
Yes: With Prometheus, I have to write metrics to a endpoint, for example This issue, I have to do this in enterprise-grade environments. In such environments DNS can also have some issues which are impossible so fix or solve. I have to provide a DNS agonistic solution here is barely base on IP addresses. As workaround, I would like to configure Prometheus to call the IP directly, for example: An other solution would be |
I will look at this, but better, look at generic HTTP headers config. |
Thanks @roidelapluie, looking forward. |
The config does say
but honestly I don't know what those headers are that Prometheus sets itself. At least in the
and
|
Various headers are set by RoundTrip functions that defined on the http client. prometheus/storage/remote/client.go Lines 182 to 187 in aaf5d64
prometheus/storage/remote/azuread/azuread.go Lines 182 to 192 in aaf5d64
Other less specific RoundTrip are defined in prometheus/common After looking a bit deeper in the code, I feel it make more sense to add a dedicated |
Superseded by prometheus/common#549 |
This PR allow to overwrite the HTTP Host header via
headers