Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upSupport for reverse proxy that changes path #1191
Comments
This comment has been minimized.
This comment has been minimized.
|
@neelance Interesting, https://cloud.google.com/container-engine/docs/kubectl/proxy says it's for connecting to the Kubernetes API server, but I guess people use it for connecting to other things as well? So it basically only works for web pages that only have relative paths in links and no absolute ones? |
This comment has been minimized.
This comment has been minimized.
|
The problem with making all links relative in Prometheus is that at least console template library functionality from https://github.com/prometheus/prometheus/blob/master/console_libraries/prom.lib can be included from arbitrary path depths, so it would add complexity to make it come up with the right relative links somehow. @neelance Is being able to use something through |
This comment has been minimized.
This comment has been minimized.
|
@juliusv I think there is no need to make all paths relative, the approach with |
This comment has been minimized.
This comment has been minimized.
|
Not sure how much more complex it usually is to set up a proxy that alters the path like you suggest, but there's another reason why we include the path prefix in the HTTP routes right now: if we didn't, it would be impossible to use the Prometheus server UI directly, even though you often only need to use a proxy in certain situations (like when you're accessing it from a wall screen in a restricted dashboard VPN). One idea would be to additionally handle all routes without the prefix, but that could cause collisions between the chosen path prefix and a route. So if we want to support proxies that change the path, we will have to add a separate flag to turn off path prefixes for the actual HTTP routes and only include the path prefix in links back to Prometheus. I can send a PR and then people can discuss whether they like the idea or think that it's one flag too much :) Other ideas welcome. |
juliusv
added a commit
that referenced
this issue
Oct 30, 2015
juliusv
referenced this issue
Oct 30, 2015
Closed
Make path-prefixing of served HTTP routes optional. #1193
brian-brazil
added
the
feature-request
label
Dec 16, 2015
fabxc
added this to the v1.0.0 milestone
Apr 26, 2016
This comment has been minimized.
This comment has been minimized.
chancez
commented
Apr 26, 2016
|
Im sort of a fan of how Grafana handles all of this: https://github.com/grafana/grafana/blob/master/conf/defaults.ini#L24-L48 Basically you I'd also like to say the current approach Prometheus takes is a bit confusing, but Grafana's configuration is very obvious in how it would behave (to me at least) so it would be worth trying to approach this similarly. Also, Grafana's approach is pretty flexible because you can interpolate, or just hardcode the root_url. I don't really think interpolation is needed, but being able to override the whole URL seen by the browser in the config, without the redirect logic would be great. |
fabxc
added
kind/enhancement
needs review
and removed
feature request
labels
Apr 28, 2016
This comment has been minimized.
This comment has been minimized.
|
Just capturing the TL;DR of a discussion in the Kubernetes slack here: This is not so much an issue with |
This comment has been minimized.
This comment has been minimized.
jnardiello
commented
Jun 16, 2016
•
|
Absolutely +1 to what @matthiasr just mentioned. I spent the whole day trying to understand what was the issue here. Having this fixed it's essential in order to even try prometheus on k8s |
This comment has been minimized.
This comment has been minimized.
|
Okay, so ultimately distinguishing between frontend and backend path rewriting both seem necessary. @chancez did I get your objection correctly, that the missing use case in #1193 is that one might want different path prefixes for the frontend and backend paths? |
This comment has been minimized.
This comment has been minimized.
chancez
commented
Jun 27, 2016
|
@fabxc I think so. I'm mostly concerned that the frontend, always needs to have it's hyperlink's updated so the basepath is correct if you change the internal route prefix/basepath. I'm not 100% sure they need both need their own flags right now though. A flag which updates the basepaths for hyperlinks in the web frontend + the routes in the backend will probably be enough. I'll let you try and see what makes sense. |
This comment has been minimized.
This comment has been minimized.
|
@chancez But that's essentially what we have right now. We take the path of the external URL and use it for the resource links in the HTML. We also take the path of the external URL and prepend it to the routes internally. @juliusv suggested adding a boolean flag optinally switching the internal prefixing on and off. We should get this resolved in the next few days. |
This comment has been minimized.
This comment has been minimized.
|
We could add `-web.route-prefix` but default to the path from
`-web.external-url` – that way we have the full flexibility but keep the
current behavior if the former is not specified.
|
This comment has been minimized.
This comment has been minimized.
|
Good idea! On Sun, Jul 3, 2016, 6:26 PM Matthias Rampke notifications@github.com
|
fgeller
added a commit
to movio/prometheus
that referenced
this issue
Jul 4, 2016
fabxc
added a commit
that referenced
this issue
Jul 5, 2016
fabxc
added a commit
that referenced
this issue
Jul 7, 2016
fabxc
closed this
in
#1791
Jul 10, 2016
juliusv
referenced this issue
Nov 17, 2016
Closed
when -web.route-prefix is set, resource and nav links are not prefixed #2193
discordianfish
referenced this issue
Jun 29, 2017
Closed
Add web.alert-url parameter so we can run behind reverse-proxy #706
This comment has been minimized.
This comment has been minimized.
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. |
neelance commentedOct 29, 2015
I am trying to access Prometheus via the Kubernetes reverse proxy (
kubectl proxy). The resulting URL ishttp://localhost:8001/api/v1/proxy/namespaces/prod/services/prometheus/graphwhich gets proxied to the path/graphon the Prometheus server. Problem is that the JS can not load its resources, since it tries to usehttp://localhost:8001/static/js/instead ofhttp://localhost:8001/api/v1/proxy/namespaces/prod/services/prometheus/static/js/.I found the
-web.external-urlflag, but it does not solve my problem. If I do-web.external-url=/api/v1/proxy/namespaces/prod/services/prometheus/thenhttp://localhost:8001/api/v1/proxy/namespaces/prod/services/prometheus/graphdoes not work any more, because it would need to behttp://localhost:8001/api/v1/proxy/namespaces/prod/services/prometheus/api/v1/proxy/namespaces/prod/services/prometheus/graph. So I can't solve the issue with the flag because it expects that the reverse proxy does not change the path, which the Kubernetes proxy does.