influxdb(auth): fixed issue with using basic auth and influxdb, fixes #2455

This commit is contained in:
Torkel Ödegaard
2015-08-07 11:01:59 +02:00
parent 776ca86a60
commit 0ed4744a33
2 changed files with 43 additions and 57 deletions

View File

@ -42,9 +42,10 @@ func NewReverseProxy(ds *m.DataSource, proxyPath string) *httputil.ReverseProxy
} else if ds.Type == m.DS_INFLUXDB {
req.URL.Path = util.JoinUrlFragments(target.Path, proxyPath)
reqQueryVals.Add("db", ds.Database)
reqQueryVals.Add("u", ds.User)
reqQueryVals.Add("p", ds.Password)
req.URL.RawQuery = reqQueryVals.Encode()
if !ds.BasicAuth {
req.Header.Add("Authorization", util.GetBasicAuthHeader(ds.User, ds.Password))
}
} else {
req.URL.Path = util.JoinUrlFragments(target.Path, proxyPath)
}