From 84bb32756431f179d28d4720bf3aae6f7f8ce66e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20S=CC=8Ctibrany=CC=81?= Date: Tue, 10 Dec 2019 10:52:16 +0100 Subject: [PATCH 1/4] Fix redirects on /ring page by using relative targets. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Štibraný --- pkg/ring/http.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pkg/ring/http.go b/pkg/ring/http.go index 36587c2572e..f8a5cc5a07f 100644 --- a/pkg/ring/http.go +++ b/pkg/ring/http.go @@ -59,9 +59,9 @@ const tpl = `
{{ if .ShowTokens }} - + {{ else }} - + {{ end }}
{{ .Ring }}
@@ -98,7 +98,13 @@ func (r *Ring) ServeHTTP(w http.ResponseWriter, req *http.Request) { // Implement PRG pattern to prevent double-POST and work with CSRF middleware. // https://en.wikipedia.org/wiki/Post/Redirect/Get - http.Redirect(w, req, req.RequestURI, http.StatusFound) + + // http.Redirect() would convert our relative URL to absolute, which is not what we want. + // Browser knows how to do that, and it also knows real URL. Furthermore it will also preserve tokens parameter. + // Note that relative Location URLs are explicitely allowed by specification, so we're not doing anything wrong here. + w.Header().Set("Location", "#") + w.WriteHeader(http.StatusFound) + return } From e80ae6a67e9ff5990bfbbf5333af4876e0b8a8b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20S=CC=8Ctibrany=CC=81?= Date: Tue, 10 Dec 2019 11:04:24 +0100 Subject: [PATCH 2/4] CHANGELOG.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Štibraný --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 509f3c59212..c381ab7ebf1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ * `ruler.poll-interval` has been added to specify the interval in which to poll new rule groups. * [FEATURE] The distributor can now drop labels from samples (similar to the removal of the replica label for HA ingestion) per user via the `distributor.drop-label` flag. #1726 * [BUGFIX] Fixed unnecessary CAS operations done by the HA tracker when the jitter is enabled. #1861 +* [CHANGE] Use relative links from /ring page to make it work when used behind reverse proxy. #1896 ## 0.4.0 / 2019-12-02 From 6796aed6d6fa715b59dc02dc1f5450d18a19d584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20S=CC=8Ctibrany=CC=81?= Date: Tue, 10 Dec 2019 11:04:50 +0100 Subject: [PATCH 3/4] CHANGELOG.md, correct order. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Štibraný --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c381ab7ebf1..f310331b98b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,9 @@ * `ruler.rule-path` has been added to specify where the prometheus rule manager will sync rule files * `ruler.storage.type` has beem added to specify the rule store backend type, currently only the configdb. * `ruler.poll-interval` has been added to specify the interval in which to poll new rule groups. +* [CHANGE] Use relative links from /ring page to make it work when used behind reverse proxy. #1896 * [FEATURE] The distributor can now drop labels from samples (similar to the removal of the replica label for HA ingestion) per user via the `distributor.drop-label` flag. #1726 * [BUGFIX] Fixed unnecessary CAS operations done by the HA tracker when the jitter is enabled. #1861 -* [CHANGE] Use relative links from /ring page to make it work when used behind reverse proxy. #1896 ## 0.4.0 / 2019-12-02 From 9a64ebaa09e4f00bcd8cea197a4948b22f56e2e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20S=CC=8Ctibrany=CC=81?= Date: Tue, 10 Dec 2019 11:25:58 +0100 Subject: [PATCH 4/4] Fix typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Štibraný --- pkg/ring/http.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/ring/http.go b/pkg/ring/http.go index f8a5cc5a07f..a1e7adcec31 100644 --- a/pkg/ring/http.go +++ b/pkg/ring/http.go @@ -101,7 +101,7 @@ func (r *Ring) ServeHTTP(w http.ResponseWriter, req *http.Request) { // http.Redirect() would convert our relative URL to absolute, which is not what we want. // Browser knows how to do that, and it also knows real URL. Furthermore it will also preserve tokens parameter. - // Note that relative Location URLs are explicitely allowed by specification, so we're not doing anything wrong here. + // Note that relative Location URLs are explicitly allowed by specification, so we're not doing anything wrong here. w.Header().Set("Location", "#") w.WriteHeader(http.StatusFound)