From 959c300b635b1b40402b334cacddf851521f3851 Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Thu, 5 Nov 2020 16:14:26 +0000 Subject: [PATCH] Query Frontend: Set CORS header Set CORS to the query frontend component in order to be able to freely access it from Grafana's living elsewhere. This is similar to what already happens for the Query component. Signed-off-by: Markos Chandras --- CHANGELOG.md | 1 + cmd/thanos/query_frontend.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index edd58d23db..33ed1bb8a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re - [#3257](https://github.com/thanos-io/thanos/pull/3257) Ruler: Prevent Ruler from crashing when using default DNS to lookup hosts that results in "No such hosts" errors. - [#3331](https://github.com/thanos-io/thanos/pull/3331) Disable Azure blob exception logging - [#3341](https://github.com/thanos-io/thanos/pull/3341) Disable Azure blob syslog exception logging +- [#3414](https://github.com/thanos-io/thanos/pull/3414) Set CORS for Query Frontend ### Changed diff --git a/cmd/thanos/query_frontend.go b/cmd/thanos/query_frontend.go index 674ddd0c96..dfdc9ae7d9 100644 --- a/cmd/thanos/query_frontend.go +++ b/cmd/thanos/query_frontend.go @@ -19,6 +19,7 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/weaveworks/common/user" + "github.com/thanos-io/thanos/pkg/api" "github.com/thanos-io/thanos/pkg/component" "github.com/thanos-io/thanos/pkg/extflag" "github.com/thanos-io/thanos/pkg/extkingpin" @@ -199,6 +200,7 @@ func runQueryFrontend( instr := func(f http.HandlerFunc) http.HandlerFunc { hf := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { name := "query-frontend" + api.SetCORS(w) ins.NewHandler( name, logMiddleware.HTTPMiddleware(