mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 10:02:26 +08:00
Allow for proxying Authorization header and automatically convert (#4832)
Authorization header to X-DS-Authorization in backend_srv.js
This commit is contained in:

committed by
Torkel Ödegaard

parent
4038b4d17e
commit
c9d6321f38
@ -55,6 +55,13 @@ func NewReverseProxy(ds *m.DataSource, proxyPath string, targetUrl *url.URL) *ht
|
||||
req.Header.Add("Authorization", util.GetBasicAuthHeader(ds.BasicAuthUser, ds.BasicAuthPassword))
|
||||
}
|
||||
|
||||
dsAuth := req.Header.Get("X-DS-Authorization")
|
||||
if len(dsAuth) > 0 {
|
||||
req.Header.Del("X-DS-Authorization")
|
||||
req.Header.Del("Authorization")
|
||||
req.Header.Add("Authorization", dsAuth)
|
||||
}
|
||||
|
||||
// clear cookie headers
|
||||
req.Header.Del("Cookie")
|
||||
req.Header.Del("Set-Cookie")
|
||||
|
Reference in New Issue
Block a user