Issue: can’t use direct link/refresh when reverse proxy is activated (Grafana has failed to load its application files)

Hello,

I am running Grafana behing Nginx. but once the reverse proxy is activated, I cannot refresh a specific page or go to it directly (I can only navigate from the base_url root path).

Seems related to the fact that when I want to navigate another page (dashboard by example), the redirection is managed by javascript (the url change in the browser but it’s not used by grafana). When I try to go directly on this url (dashboard ur), you can see the screenshot in the bottom.

  • Grafana configuration (server) (domain/url cleaned due to discourse limitation)

[server]
protocol = http
http_port = 3000
domain = example[dot]com
enforce_domain = true
root_url = https_example[dot]com/grafana
router_logging = false
serve_from_sub_path = true

  • Nginx configuration:
location ^~ /grafana/ {
    proxy_set_header X-Forwarded-Host example[dot]com;
    proxy_set_header Host example[dot]com;
    proxy_pass http_grafana_hostname:3000/;
}
  • Steps to reproduce:
  1. Open https_example[dot]com/grafana
  2. Connect to github
  3. Open specific dashboard https grafana_hostname:3000/d/XXXXX/test_dashboard?orgId=1&refresh=5s via home page: works
  4. Refresh this page or open directly this page: doesn’t works

If I try to go on http grafana_hostname:3000/d/XXXXX/test_dashboard?orgId=1&refresh=5s (backend url), it works (with enforce_domain to false).

Best regards,

Issue fixed:

For unknow reason, the resources generated by grafana via RP was:
/grafana/d/XXXX/public/build/moment~app.XXXX.js instead /grafana/public/build/moment~app.XXXX.js

Requests now rewrited on the fly…