{"action":"created","issue":{"url":"https://api.github.com/repos/prometheus/prometheus/issues/1191","repository_url":"https://api.github.com/repos/prometheus/prometheus","labels_url":"https://api.github.com/repos/prometheus/prometheus/issues/1191/labels{/name}","comments_url":"https://api.github.com/repos/prometheus/prometheus/issues/1191/comments","events_url":"https://api.github.com/repos/prometheus/prometheus/issues/1191/events","html_url":"https://github.com/prometheus/prometheus/issues/1191","id":114155427,"number":1191,"title":"Support for reverse proxy that changes path","user":{"login":"neelance","id":16184,"avatar_url":"https://avatars.githubusercontent.com/u/16184?v=3","gravatar_id":"","url":"https://api.github.com/users/neelance","html_url":"https://github.com/neelance","followers_url":"https://api.github.com/users/neelance/followers","following_url":"https://api.github.com/users/neelance/following{/other_user}","gists_url":"https://api.github.com/users/neelance/gists{/gist_id}","starred_url":"https://api.github.com/users/neelance/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neelance/subscriptions","organizations_url":"https://api.github.com/users/neelance/orgs","repos_url":"https://api.github.com/users/neelance/repos","events_url":"https://api.github.com/users/neelance/events{/privacy}","received_events_url":"https://api.github.com/users/neelance/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/prometheus/prometheus/labels/feature-request","name":"feature-request","color":"02e10c"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/prometheus/prometheus/milestones/3","html_url":"https://github.com/prometheus/prometheus/milestones/v1.0.0","labels_url":"https://api.github.com/repos/prometheus/prometheus/milestones/3/labels","id":1729605,"number":3,"title":"v1.0.0","description":null,"creator":{"login":"fabxc","id":4948210,"avatar_url":"https://avatars.githubusercontent.com/u/4948210?v=3","gravatar_id":"","url":"https://api.github.com/users/fabxc","html_url":"https://github.com/fabxc","followers_url":"https://api.github.com/users/fabxc/followers","following_url":"https://api.github.com/users/fabxc/following{/other_user}","gists_url":"https://api.github.com/users/fabxc/gists{/gist_id}","starred_url":"https://api.github.com/users/fabxc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabxc/subscriptions","organizations_url":"https://api.github.com/users/fabxc/orgs","repos_url":"https://api.github.com/users/fabxc/repos","events_url":"https://api.github.com/users/fabxc/events{/privacy}","received_events_url":"https://api.github.com/users/fabxc/received_events","type":"User","site_admin":false},"open_issues":11,"closed_issues":0,"state":"open","created_at":"2016-04-25T16:59:44Z","updated_at":"2016-04-26T09:19:15Z","due_on":null,"closed_at":null},"comments":5,"created_at":"2015-10-29T21:51:37Z","updated_at":"2016-04-26T22:00:09Z","closed_at":null,"body":"I am trying to access Prometheus via the Kubernetes reverse proxy (`kubectl proxy`). The resulting URL is `http://localhost:8001/api/v1/proxy/namespaces/prod/services/prometheus/graph` which gets proxied to the path `/graph` on the Prometheus server. Problem is that the JS can not load its resources, since it tries to use  `http://localhost:8001/static/js/` instead of  `http://localhost:8001/api/v1/proxy/namespaces/prod/services/prometheus/static/js/`.\r\n\r\nI found the `-web.external-url` flag, but it does not solve my problem. If I do `-web.external-url=/api/v1/proxy/namespaces/prod/services/prometheus/` then `http://localhost:8001/api/v1/proxy/namespaces/prod/services/prometheus/graph` does not work any more, because it would need to be `http://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."},"comment":{"url":"https://api.github.com/repos/prometheus/prometheus/issues/comments/214900982","html_url":"https://github.com/prometheus/prometheus/issues/1191#issuecomment-214900982","issue_url":"https://api.github.com/repos/prometheus/prometheus/issues/1191","id":214900982,"user":{"login":"chancez","id":1400401,"avatar_url":"https://avatars.githubusercontent.com/u/1400401?v=3","gravatar_id":"","url":"https://api.github.com/users/chancez","html_url":"https://github.com/chancez","followers_url":"https://api.github.com/users/chancez/followers","following_url":"https://api.github.com/users/chancez/following{/other_user}","gists_url":"https://api.github.com/users/chancez/gists{/gist_id}","starred_url":"https://api.github.com/users/chancez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chancez/subscriptions","organizations_url":"https://api.github.com/users/chancez/orgs","repos_url":"https://api.github.com/users/chancez/repos","events_url":"https://api.github.com/users/chancez/events{/privacy}","received_events_url":"https://api.github.com/users/chancez/received_events","type":"User","site_admin":false},"created_at":"2016-04-26T22:00:09Z","updated_at":"2016-04-26T22:00:09Z","body":"Im sort of a fan of how Grafana handles all of this: https://github.com/grafana/grafana/blob/master/conf/defaults.ini#L24-L48\r\n\r\nBasically you `domain` and `enforce_domain` is effectively `web.external_url` and #1193 `web.prefix-routes`. However I'm not convinced the above PR alone is enough for all use-cases, for example when you don't want to redirect, but do want both the to set a prefix on both the server-side and front-end (not just the frontend, which is what the above PR allows).\r\n\r\nI'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. \r\n\r\nAlso, 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."}}