From e7131470cdf39f7ecdcfe84245343b31ab2f8bcd Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Wed, 17 May 2023 14:58:15 +0200 Subject: [PATCH] [v10.0.x] Docs: Update run behind proxy docs (#68610) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Docs: Update run behind proxy docs (#68608) (cherry picked from commit 5457a9ecf25438d62ce449e805d7da59f3d9c0af) Co-authored-by: Torkel Ödegaard --- docs/sources/setup-grafana/configure-grafana/_index.md | 5 ++--- .../sources/tutorials/run-grafana-behind-a-proxy/index.md | 8 ++++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/sources/setup-grafana/configure-grafana/_index.md b/docs/sources/setup-grafana/configure-grafana/_index.md index 4cc55fd8217..18fe45d709a 100644 --- a/docs/sources/setup-grafana/configure-grafana/_index.md +++ b/docs/sources/setup-grafana/configure-grafana/_index.md @@ -233,9 +233,8 @@ callback URL to be correct). Serve Grafana from subpath specified in `root_url` setting. By default it is set to `false` for compatibility reasons. -By enabling this setting and using a subpath in `root_url` above, e.g. -`root_url = http://localhost:3000/grafana`, Grafana is accessible on -`http://localhost:3000/grafana`. +By enabling this setting and using a subpath in `root_url` above, e.g.`root_url = http://localhost:3000/grafana`, Grafana is accessible on `http://localhost:3000/grafana`. If accessed without subpath Grafana will redirect to +an URL with the subpath. ### router_logging diff --git a/docs/sources/tutorials/run-grafana-behind-a-proxy/index.md b/docs/sources/tutorials/run-grafana-behind-a-proxy/index.md index 10be2dee35f..fcbbadbea01 100644 --- a/docs/sources/tutorials/run-grafana-behind-a-proxy/index.md +++ b/docs/sources/tutorials/run-grafana-behind-a-proxy/index.md @@ -106,14 +106,12 @@ server { index index.html index.htm; location /grafana/ { - rewrite ^/grafana/(.*) /$1 break; proxy_set_header Host $http_host; proxy_pass http://grafana; } # Proxy Grafana Live WebSocket connections. location /grafana/api/live/ { - rewrite ^/grafana/(.*) /$1 break; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; @@ -123,6 +121,12 @@ server { } ``` +If your Grafana configuration does not set `serve_from_sub_path` to true then you need to add a rewrite rule to each location block: + +``` + rewrite ^/grafana/(.*) /$1 break; +``` + ## Configure HAProxy To configure HAProxy to serve Grafana under a _sub path_: