diff --git a/internal/debug/flags.go b/internal/debug/flags.go index 42218510e..3eab6e518 100644 --- a/internal/debug/flags.go +++ b/internal/debug/flags.go @@ -241,6 +241,7 @@ func StartPProf(address string, withMetrics bool) { // from the registry into expvar, and execute regular expvar handler. if withMetrics { http.HandleFunc("/debug/metrics/prometheus", func(w http.ResponseWriter, req *http.Request) { + w.Header().Set("Access-Control-Allow-Origin", "*") metrics2.WritePrometheus(w, true) }) } diff --git a/metrics/exp/exp.go b/metrics/exp/exp.go index c894dd6ae..f06905c1f 100644 --- a/metrics/exp/exp.go +++ b/metrics/exp/exp.go @@ -46,6 +46,7 @@ func ExpHandler(r metrics.Registry) http.Handler { // This function enables metrics reporting separate from pprof. func Setup(address string) { http.HandleFunc("/debug/metrics/prometheus", func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Access-Control-Allow-Origin", "*") metrics2.WritePrometheus(w, true) }) //m.Handle("/debug/metrics", ExpHandler(metrics.DefaultRegistry))