[ui][pyroscope] Running Pyroscope UI behind a proxy
cyriltovena opened this issue · 4 comments
If we run the application behind a proxy with a path like : https://admin-dev-us-central-0.grafana.net/directory-phlare/fire-dev-001/query-frontend/ui/?query=
Then the queries goes to:
https://admin-dev-us-central-0.grafana.net/pyroscope/label-values?label=__name__
but should go to:
https://admin-dev-us-central-0.grafana.net/directory-phlare/fire-dev-001/query-frontend/pyroscope/label-values?label=__name__
Requests use
https://github.com/grafana/pyroscope/blob/main/webapp/javascript/services/base.ts#L70
Which currently depend on a custom meta tag
https://github.com/grafana/pyroscope/blob/main/webapp/javascript/util/baseurl.ts#L4-L6
We can either override the entire @webapp/util/baseurl
file, or make the backend preprocess the index.html
file and add the tag to the<head>
.
Just an update, after #645, we will need to make the backend inject a base
tag to index.html
.
I might just be missing the point, but why can't we set BASE_URL
relatively like ../
? Ideally I want this to work without a CLI flag, so that the reverse proxy can mount it under /tools/pyrscope/ui
or under /tooling/profiles/ui
while still using the same instance that just thinkgs it is accessed at /ui
If we set BASE_URL to ../
, if we have a SPA route like ui/path/subpath
, then assets would be loaded from ui/path/
, which is wrong.
If we are talking about being smart, we could technically (in js) get the current url and treat everything before /ui
as the basepath.
Example:
http://localhost:9999/tools/pyroscope/ui
Subpath is /tools/pyroscope/
.
However this JS needs to be the first thing in the head
(before any other assets), then run synchronously, then set the <base>
tag dynamically.
But that's makes things slower, and it relies on always serving under a well-known path (/ui
), which may not be what we want.