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

Prometheus adds default http port to the Host header when querying targets. #2226

Closed
ddewaele opened this Issue Nov 28, 2016 · 3 comments

Comments

Projects
None yet
4 participants
@ddewaele
Copy link

ddewaele commented Nov 28, 2016

What did you do?

Added a static config to monitor a webapp exposing a prometheus endpoint

    static_configs:
      - targets: ['someServer:80']
        labels:
          group: 'monitoring'

What did you expect to see?

The target is sitting behind a reverse proxy (haProxy) and we cannot access the target directly.
haProxy expected to see a Host header like this :

Host : someServer

What did you see instead? Under which circumstances?

But instead saw was this :

Host : someServer:80

Although this does not violate the http spec, the spec does allow for default http ports (80 / 443) to be stripped from the Host header. (https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23).

We needed to modify our haProxy configuration so that it properly matched incoming http requests from prometheus.

@fabxc

This comment has been minimized.

Copy link
Member

fabxc commented Nov 28, 2016

If both are valid, that is not something we are likely to change. First, we tend to err on the side of explicitness and secondly, other people might already rely on the way it is now and changing it would break them, which we cannot do within 1.x

@matthiasr

This comment has been minimized.

Copy link
Contributor

matthiasr commented Nov 28, 2016

@grobie grobie closed this Mar 5, 2017

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 23, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 23, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.