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 · 4 comments
Closed

Comments

@ddewaele
Copy link

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
Copy link
Contributor

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
Copy link
Contributor

matthiasr commented Nov 28, 2016 via email

@grobie grobie closed this as completed Mar 5, 2017
@lock
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
@roidelapluie
Copy link
Member

#9523 adds an option to change this behaviour.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants