mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 09:12:10 +08:00
Backend plugins: Prepare and clean request headers before resource calls (#22321)
Moves common request proxy utilities to proxyutil package with support for removing X-Forwarded-Host, X-Forwarded-Port, X-Forwarded-Proto headers, setting X-Forwarded-For header and cleaning Cookie header. Using the proxyutil package to prepare and clean request headers before resource calls. Closes #21512
This commit is contained in:

committed by
GitHub

parent
8b122ee464
commit
e6cec8dbdc
@ -205,12 +205,17 @@ func (p *BackendPlugin) callResource(ctx context.Context, req CallResourceReques
|
||||
reqHeaders[k] = &pluginv2.CallResource_StringList{Values: v}
|
||||
}
|
||||
|
||||
jsonDataBytes, err := req.Config.JSONData.ToDB()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
protoReq := &pluginv2.CallResource_Request{
|
||||
Config: &pluginv2.PluginConfig{
|
||||
OrgId: req.Config.OrgID,
|
||||
PluginId: req.Config.PluginID,
|
||||
PluginType: req.Config.PluginType,
|
||||
JsonData: req.Config.JSONData,
|
||||
JsonData: jsonDataBytes,
|
||||
DecryptedSecureJsonData: req.Config.DecryptedSecureJSONData,
|
||||
UpdatedMS: req.Config.Updated.UnixNano() / int64(time.Millisecond),
|
||||
},
|
||||
|
Reference in New Issue
Block a user