Skip to content
This repository was archived by the owner on Mar 17, 2021. It is now read-only.

Commit 8003b0c

Browse files
sl1pm4tapparentlymart
authored andcommitted
If the base URL includes a path component, don’t overwrite this with the
request path. This is necessary when Grafana is running behind a reverse proxy that is doing path based routing.
1 parent 35245a0 commit 8003b0c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

client.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"net/http"
99
"net/url"
1010
"os"
11+
"path"
1112
"strings"
1213
)
1314

@@ -38,9 +39,9 @@ func New(auth, baseURL string) (*Client, error) {
3839
}, nil
3940
}
4041

41-
func (c *Client) newRequest(method, path string, body io.Reader) (*http.Request, error) {
42+
func (c *Client) newRequest(method, requestPath string, body io.Reader) (*http.Request, error) {
4243
url := c.baseURL
43-
url.Path = path
44+
url.Path = path.Join(url.Path, requestPath)
4445
req, err := http.NewRequest(method, url.String(), body)
4546
if err != nil {
4647
return req, err

0 commit comments

Comments
 (0)