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 upwhen -web.route-prefix is set, resource and nav links are not prefixed #2193
Comments
bitplane
changed the title
when -web.route-prefix is set, resource and nav paths are not prefixed
when -web.route-prefix is set, resource and nav links are not prefixed
Nov 17, 2016
This comment has been minimized.
This comment has been minimized.
|
Yeah, that's a bit tricky. Can you try instead: |
This comment has been minimized.
This comment has been minimized.
|
My problem is that my hostname isn't fixed. When accessing the box externally I'm sometimes using a tunnel, so http://localhost:port/prometheus/ while internally it's http://internal-host/prometheus/, when I have get routing in place it'll be https://external-ip/prometheus and eventually https://domain.com/prometheus but only from places where I have my client cert installed, elsewhere I'll use a tunnel to the non-proxied url. Unless there's something I've overlooked, I think it would work in all cases if we prefixed the path with |
This comment has been minimized.
This comment has been minimized.
jangaraj
commented
Jan 3, 2017
|
Try to rewrite/fix html links (no
|
This comment has been minimized.
This comment has been minimized.
undeadops
commented
Jan 24, 2017
|
Solution proposed by @jangaraj works for me... don't really care for it being a solution the -web.route-prefix should be able to make it rewrite the static urls for CSS etc.. |
This comment has been minimized.
This comment has been minimized.
s4s0l
commented
Feb 21, 2017
|
@bitplane FYI setting http://localhost/prometheus will not prevent it from working no matter what domain will you use |
This comment has been minimized.
This comment has been minimized.
tylux
commented
Feb 23, 2017
|
@jangaraj I tried out your nginx config, and it all seems to work except for the /graph page loading the query fields. http:///static/js/graph_template.handlebar?_=1487884039083 when it should have /prometheus at the front http:///prometheus/static/js/graph_template.handlebar?_=1487884039083 is that the config you are still running? |
This comment has been minimized.
This comment has been minimized.
jangaraj
commented
Feb 24, 2017
|
I see the same problem in my project https://github.com/monitoringartist/play.monitoringartist.com . Rewrite part
needs some improvement. Try to add another subfilter:
I'll test it later. |
This comment has been minimized.
This comment has been minimized.
tylux
commented
Feb 24, 2017
|
@jangaraj that additional sub_filter worked for me, Thanks! |
This comment has been minimized.
This comment has been minimized.
jangaraj
commented
Feb 24, 2017
•
|
OK, so current workaround is nginx proxy (no special prometheus settings
|
This comment has been minimized.
This comment has been minimized.
ageis
commented
Mar 21, 2017
|
I have the same problem, trying to run Prometheus through an nginx reverse proxy at I've tried all the solutions and directives above and I am getting |
This comment has been minimized.
This comment has been minimized.
dhoppe
commented
Mar 27, 2017
•
|
I had the same problem and solved it with a sligthly different configuration.
For some reason I had to append Unfortunately you also have to change the metrics_path for the Prometheus job. Otherwise Prometheus is not able to determine the status of the Prometheus endpoint. |
This comment has been minimized.
This comment has been minimized.
jangaraj
commented
Mar 27, 2017
|
@dhoppe You need to add path |
This comment has been minimized.
This comment has been minimized.
dhoppe
commented
Mar 27, 2017
|
@jangaraj I know, but without it always jumps back from /prometheus to /graph and shows an error page. That is the reason why I added the -web.route-prefix. |
This comment has been minimized.
This comment has been minimized.
jangaraj
commented
Mar 28, 2017
|
@dhoppe I agree. Your workaround |
This comment has been minimized.
This comment has been minimized.
stevepeak
commented
Apr 12, 2017
|
This configuration works. Thank you for your help |
This comment has been minimized.
This comment has been minimized.
|
Looks to me like #1791 alone isn't very useful without this getting fixed, right? |
This comment has been minimized.
This comment has been minimized.
|
Note |
This comment has been minimized.
This comment has been minimized.
|
@discordianfish getting what fixed? A summary of the findings from this thread would be appreciated as it's literally nginx configs been thrown around. |
This comment has been minimized.
This comment has been minimized.
|
Oh I understood this issue being about assets not prefixed. If that is already fixed, I guess this should get closed? |
This comment has been minimized.
This comment has been minimized.
|
Okay, so that should happen afaics: https://github.com/prometheus/prometheus/blob/master/web/ui/templates/_base.html#L6-L14 |
fabxc
closed this
Jul 5, 2017
This comment has been minimized.
This comment has been minimized.
|
Yes, but also see my comment here. I think this is broken right now in general: #1583 (comment) |
This comment has been minimized.
This comment has been minimized.
trentbullard
commented
Mar 1, 2018
•
|
when i implement @dhoppe final solution the web interface loads correctly, but when i open the Status>Targets page, prometheus shows (0/1 up) and the endpoint is http://localhost:9090/metrics Shouldn't this be .../prometheus/metrics? edit: added |
This comment has been minimized.
This comment has been minimized.
mclamb
commented
Apr 16, 2018
|
Does the solution proposed by @jangaraj still work for everyone? I am trying to get path-based routing working without having to change any prometheus settings like
Thanks! |
This comment has been minimized.
This comment has been minimized.
mclamb
commented
Apr 16, 2018
|
I found a comment by @sylr in #1583 that seems to resolve my issue with the /graph redirect, in combination with the solution by @jangaraj above. The full location clause is:
Can anyone else confirm that these are the minimal settings required to get path-based routing working properly without resorting to editing prometheus config itself (i.e setting Thanks |
This comment has been minimized.
This comment has been minimized.
kvishweshwar
commented
Apr 22, 2018
•
|
@mclamb, Yes it is working properly for Prometheus, without having to have any kind of configuration changes, but not working for Grafana. Thanks! |
This comment has been minimized.
This comment has been minimized.
kvishweshwar
commented
Apr 22, 2018
•
|
#5908 this may be useful to resolve Grafana related issues. |
This comment has been minimized.
This comment has been minimized.
AJ15416
commented
Jul 20, 2018
•
|
Does anyone have an apache equivalent to @mclamb 's solution? I am still not able to solve the /prometheus redirecting to /graph problem. I have the following and I am able to get everything except the redirect working.
This is the portion I am having trouble with
I've tried working with RewriteEngine, Rewrite, and just throwing another RedirectMatch in there, but nothing seems to get the job done. |
This comment has been minimized.
This comment has been minimized.
foscoj
commented
Nov 28, 2018
Thanks, still working for prometheus via nginx! |
This comment has been minimized.
This comment has been minimized.
fchiorascu
commented
Nov 29, 2018
For me this is not working at all. |
bitplane commentedNov 17, 2016
What did you do?
Launch
prometheus -web.route-prefix=/prometheus, set nginx to proxy http://localhost/prometheus to http://localhost:9090/prometheusWhat did you expect to see?
A graph at http://localhost/prometheus/graph and the ability to navigate between pages.
What did you see instead? Under which circumstances?
Javascript doesn't load, page navigation doesn't work.
Static resources are links to
href="/static/rather thanhref="/prometheus/static/, nav menu and link to home also points to root rather than prefix:Environment
System information:
Linux 4.4.0-45-generic x86_64 / Ubuntu 16.04
Prometheus version:
prometheus_1.2.3+ds2-1_amd64.deb