Commit a23217cc by Torkel Ödegaard

fix(influxdb): clear existing Authorization header when proxying request to InfluxDB, fixes #2778

parent f4f7f479
...@@ -43,6 +43,7 @@ func NewReverseProxy(ds *m.DataSource, proxyPath string, targetUrl *url.URL) *ht ...@@ -43,6 +43,7 @@ func NewReverseProxy(ds *m.DataSource, proxyPath string, targetUrl *url.URL) *ht
reqQueryVals.Add("db", ds.Database) reqQueryVals.Add("db", ds.Database)
req.URL.RawQuery = reqQueryVals.Encode() req.URL.RawQuery = reqQueryVals.Encode()
if !ds.BasicAuth { if !ds.BasicAuth {
req.Header.Del("Authorization")
req.Header.Add("Authorization", util.GetBasicAuthHeader(ds.User, ds.Password)) req.Header.Add("Authorization", util.GetBasicAuthHeader(ds.User, ds.Password))
} }
} else { } else {
...@@ -50,6 +51,7 @@ func NewReverseProxy(ds *m.DataSource, proxyPath string, targetUrl *url.URL) *ht ...@@ -50,6 +51,7 @@ func NewReverseProxy(ds *m.DataSource, proxyPath string, targetUrl *url.URL) *ht
} }
if ds.BasicAuth { if ds.BasicAuth {
req.Header.Del("Authorization")
req.Header.Add("Authorization", util.GetBasicAuthHeader(ds.BasicAuthUser, ds.BasicAuthPassword)) req.Header.Add("Authorization", util.GetBasicAuthHeader(ds.BasicAuthUser, ds.BasicAuthPassword))
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment