From 5ff94e528b1f983eeb5172fab85e29490a0df28a Mon Sep 17 00:00:00 2001 From: Ben Sully Date: Fri, 27 Jan 2023 09:20:55 +0000 Subject: [PATCH] API: don't re-add /api suffix to grafana.com API URL (#62280) The old GrafanaComURL setting didn't have the /api suffix so needed it adding on by the proxy director, but the new GrafanaComAPIURL setting is assumed to already point directly to the API and doesn't need an additional suffix. This is the only place in the codebase that GrafanaComAPIURL is used. --- pkg/api/grafana_com_proxy.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/api/grafana_com_proxy.go b/pkg/api/grafana_com_proxy.go index a00a0d4a80d..088b745b82f 100644 --- a/pkg/api/grafana_com_proxy.go +++ b/pkg/api/grafana_com_proxy.go @@ -23,15 +23,15 @@ var grafanaComProxyTransport = &http.Transport{ TLSHandshakeTimeout: 10 * time.Second, } -func ReverseProxyGnetReq(logger log.Logger, proxyPath string, version string, grafanaComUrl string) *httputil.ReverseProxy { - url, _ := url.Parse(grafanaComUrl) +func ReverseProxyGnetReq(logger log.Logger, proxyPath string, version string, grafanaComAPIUrl string) *httputil.ReverseProxy { + url, _ := url.Parse(grafanaComAPIUrl) director := func(req *http.Request) { req.URL.Scheme = url.Scheme req.URL.Host = url.Host req.Host = url.Host - req.URL.Path = util.JoinURLFragments(url.Path+"/api", proxyPath) + req.URL.Path = util.JoinURLFragments(url.Path, proxyPath) // clear cookie headers req.Header.Del("Cookie")