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

Add support for Authorize headers to requests to AlertManager #1537

Closed
mwitkow opened this Issue Apr 8, 2016 · 5 comments

Comments

Projects
None yet
3 participants
@mwitkow
Copy link
Contributor

mwitkow commented Apr 8, 2016

We're considering moving our AlertManagers completely out of our VPN networks, and putting it behind a reverse proxy somewhere.

We thought about just adding Basic headers into the URL, but it seems that Go doesn't automatically populate headers from URL params:

func TestUrlParsing(t *testing.T) {
    x, err := url.Parse("https://bar:foo@car.example.com/stuff")
    t.Logf("user info: %v", x.User)

    req, _ := http.NewRequest("POST", "https://bar:foo@car.example.com/stuff", nil)
    user, pass, ok := req.BasicAuth()
    t.Logf("basic auth on request: enabled=%v, user=%v, pass=%v", ok, user, pass)
}

Can we add a flag to Prometheus for the contents of the Authorize header to AlertManager requests? If not, we can always build a small local reverse proxy for these :)

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Apr 8, 2016

I don't think we'll be adding this until we've got the HA alertmanager, as this depends on moving from a flag to the config file and there's so many other options that we can't do it piecemeal.

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Apr 8, 2016

@mwitkow Putting basic auth into the URL seems to work for me. When I set -alertmanager.url=http://foo:bar@localhost:9093/, it sends Authorization: Basic Zm9vOmJhcg== on the wire.

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Apr 8, 2016

@mwitkow You are not seeing the correct header in your example because Go populates the Authorization header from the URL only upon actually sending a request: https://golang.org/src/net/http/client.go?s=6511:6572#L247

@mwitkow

This comment has been minimized.

Copy link
Contributor Author

mwitkow commented Apr 8, 2016

Great! Thanks. Not need it anymore then :)

@mwitkow mwitkow closed this Apr 8, 2016

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 24, 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 24, 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.