mirror of https://github.com/grafana/grafana.git
Docs: Add HAProxy rewrite information considering `serve_from_sub_path` setting (#80062)
* docs: specify HAProxy rewrite considering `serve_from_sub_path` setting * Update docs/sources/tutorials/run-grafana-behind-a-proxy/index.md Co-authored-by: Joseph Perez <45749060+josmperez@users.noreply.github.com> * Update docs/sources/tutorials/run-grafana-behind-a-proxy/index.md Co-authored-by: Joseph Perez <45749060+josmperez@users.noreply.github.com> * Update docs/sources/tutorials/run-grafana-behind-a-proxy/index.md Co-authored-by: Joseph Perez <45749060+josmperez@users.noreply.github.com> * Update docs/sources/tutorials/run-grafana-behind-a-proxy/index.md * Update docs/sources/tutorials/run-grafana-behind-a-proxy/index.md Co-authored-by: Will Browne <wbrowne@users.noreply.github.com> --------- Co-authored-by: Joseph Perez <45749060+josmperez@users.noreply.github.com> Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
This commit is contained in:
parent
574fae3f01
commit
464a61352c
|
|
@ -38,8 +38,8 @@ You can also serve Grafana behind a _sub path_, such as `http://example.com/graf
|
||||||
|
|
||||||
To serve Grafana behind a sub path:
|
To serve Grafana behind a sub path:
|
||||||
|
|
||||||
- Include the sub path at the end of the `root_url`.
|
1. Include the sub path at the end of the `root_url`.
|
||||||
- Set `serve_from_sub_path` to `true`.
|
1. Set `serve_from_sub_path` to `true`. Or, let proxy rewrite the path for you (refer to examples below).
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
[server]
|
[server]
|
||||||
|
|
@ -149,11 +149,18 @@ frontend http-in
|
||||||
use_backend grafana_backend if { path /grafana } or { path_beg /grafana/ }
|
use_backend grafana_backend if { path /grafana } or { path_beg /grafana/ }
|
||||||
|
|
||||||
backend grafana_backend
|
backend grafana_backend
|
||||||
# Requires haproxy >= 1.6
|
server grafana localhost:3000
|
||||||
http-request set-path %[path,regsub(^/grafana/?,/)]
|
```
|
||||||
|
|
||||||
# Works for haproxy < 1.6
|
If your Grafana configuration doesn't set `server.serve_from_sub_path` to `true`, then you must add a rewrite rule to the `backend grafana_backend` block:
|
||||||
# reqrep ^([^\ ]*\ /)grafana[/]?(.*) \1\2
|
|
||||||
|
```diff
|
||||||
|
backend grafana_backend
|
||||||
|
+ # Requires haproxy >= 1.6
|
||||||
|
+ http-request set-path %[path,regsub(^/grafana/?,/)]
|
||||||
|
|
||||||
|
+ # Works for haproxy < 1.6
|
||||||
|
+ # reqrep ^([^\ ]*\ /)grafana[/]?(.*) \1\2
|
||||||
|
|
||||||
server grafana localhost:3000
|
server grafana localhost:3000
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue