mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-02-09 15:27:11 +00:00
app/vmselect: fix accessing /graphite/*
endpoints
This commit is contained in:
parent
94148d5ad7
commit
a22aa0608b
4 changed files with 14 additions and 12 deletions
|
@ -517,7 +517,7 @@ and it is easier to use when migrating from Graphite to VictoriaMetrics.
|
|||
|
||||
[VictoriaMetrics Enterprise](https://victoriametrics.com/enterprise.html) supports [Graphite Render API](https://graphite.readthedocs.io/en/stable/render_api.html) subset
|
||||
at `/render` endpoint, which is used by [Graphite datasource in Grafana](https://grafana.com/docs/grafana/latest/datasources/graphite/).
|
||||
It supports `Storage-Step` http request header, which must be set to a step between data points stored in VictoriaMetrics when configuring Graphite datasource in Grafana.
|
||||
When configuring Graphite datasource in Grafana, the `Storage-Step` http request header must be set to a step between Graphite data points stored in VictoriaMetrics. For example, `Storage-Step: 10s` would mean 10 seconds distance between Graphite datapoints stored in VictoriaMetrics.
|
||||
Enterprise binaries can be downloaded and evaluated for free from [the releases page](https://github.com/VictoriaMetrics/VictoriaMetrics/releases).
|
||||
|
||||
|
||||
|
|
|
@ -158,17 +158,17 @@ func RequestHandler(w http.ResponseWriter, r *http.Request) bool {
|
|||
vmuiFileServer.ServeHTTP(w, r)
|
||||
return true
|
||||
}
|
||||
if strings.HasPrefix(path, "/graph") {
|
||||
if path == "/graph" {
|
||||
// Redirect to /graph/, otherwise vmui redirects to /vmui/, which can be inaccessible in user env.
|
||||
// Use relative redirect, since, since the hostname and path prefix may be incorrect if VictoriaMetrics
|
||||
// is hidden behind vmauth or similar proxy.
|
||||
_ = r.ParseForm()
|
||||
newURL := "graph/?" + r.Form.Encode()
|
||||
http.Redirect(w, r, newURL, http.StatusFound)
|
||||
return true
|
||||
}
|
||||
if strings.HasPrefix(path, "/graph/") {
|
||||
// This is needed for serving /graph URLs from Prometheus datasource in Grafana.
|
||||
if path == "/graph" {
|
||||
// Redirect to /graph/, otherwise vmui redirects to /vmui/, which can be inaccessible in user env.
|
||||
// Use relative redirect, since, since the hostname and path prefix may be incorrect if VictoriaMetrics
|
||||
// is hidden behind vmauth or similar proxy.
|
||||
_ = r.ParseForm()
|
||||
newURL := "graph/?" + r.Form.Encode()
|
||||
http.Redirect(w, r, newURL, http.StatusFound)
|
||||
return true
|
||||
}
|
||||
r.URL.Path = strings.Replace(path, "/graph/", "/vmui/", 1)
|
||||
vmuiFileServer.ServeHTTP(w, r)
|
||||
return true
|
||||
|
|
|
@ -6,6 +6,8 @@ sort: 15
|
|||
|
||||
## tip
|
||||
|
||||
* BUGFIX: vmselect: fix accessing [Graphite APIs](https://docs.victoriametrics.com/#graphite-api-usage). The access has been broken in v1.66.0, because `/graphite/*` path prefix accidentally clashed with `/graph*` path prefix used for VictoriaMetrics UI (aka `vmui`).
|
||||
|
||||
|
||||
## [v1.66.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.66.0)
|
||||
|
||||
|
|
|
@ -521,7 +521,7 @@ and it is easier to use when migrating from Graphite to VictoriaMetrics.
|
|||
|
||||
[VictoriaMetrics Enterprise](https://victoriametrics.com/enterprise.html) supports [Graphite Render API](https://graphite.readthedocs.io/en/stable/render_api.html) subset
|
||||
at `/render` endpoint, which is used by [Graphite datasource in Grafana](https://grafana.com/docs/grafana/latest/datasources/graphite/).
|
||||
It supports `Storage-Step` http request header, which must be set to a step between data points stored in VictoriaMetrics when configuring Graphite datasource in Grafana.
|
||||
When configuring Graphite datasource in Grafana, the `Storage-Step` http request header must be set to a step between Graphite data points stored in VictoriaMetrics. For example, `Storage-Step: 10s` would mean 10 seconds distance between Graphite datapoints stored in VictoriaMetrics.
|
||||
Enterprise binaries can be downloaded and evaluated for free from [the releases page](https://github.com/VictoriaMetrics/VictoriaMetrics/releases).
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue