Datasources: provide generic function to extract custom headers (#66738)

This commit is contained in:
Jean-Philippe Quéméner
2023-04-19 17:04:30 +02:00
committed by GitHub
parent 772ddbc3c0
commit 42cdec369d
6 changed files with 97 additions and 3 deletions
+1 -1
View File
@@ -340,7 +340,7 @@ func validateJSONData(jsonData *simplejson.Json, cfg *setting.Cfg) error {
}
for key, value := range jsonData.MustMap() {
if strings.HasPrefix(key, "httpHeaderName") {
if strings.HasPrefix(key, datasources.CustomHeaderName) {
header := fmt.Sprint(value)
if http.CanonicalHeaderKey(header) == http.CanonicalHeaderKey(cfg.AuthProxyHeaderName) {
datasourcesLogger.Error("Forbidden to add a data source header with a name equal to auth proxy header name", "headerName", key)