Hi,
I am trying to serve Grafana via nginx reverse-proxy. The domain has a root url and then we serve it via grafana service -
https://domainname.com/k8s/v4/{slug}/clusters/{cluster_id}/k8sapi/api/v1/namespaces/pf9-monitoring/services/http:grafana-ui:80/proxy/login
I am able to serve the Grafana UI via the proxy url but the UI shows “Page Not Found”.
I suspect this is due to the reac-router used in Grafana UI which is not able to get matching pathname and fallback to the 404-Page not found
I tried add root_url
given above to the grafana config -
root_url = https://domainname.com/k8s/v4/{cluster_id}/clusters/{cluster_id}/k8sapi/api/v1/namespaces/pf9-monitoring/services/http:grafana-ui:80/proxy/login
serve_from_sub_path = false
But it gives the below error after doing so -
My nginx config looks like this -
apiVersion: v1
data:
default.conf: |
server {
listen 80;
location / {
proxy_pass http://localhost:3000; # Proxy to the Grafana container
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
I can see that the Grafana receives the config via window.grafanaBootData.settings
which contains appSubUrl
and appUrl
. And the routing works properly when we setup appSubUrl
When we setup root_url
, both appSubUrl
and appUrl
are configure and this doesn’t work in my case. Is there a way we can setup the appSubUrl
only via grafana config ?