diff --git a/public/app/plugins/datasource/elasticsearch/datasource.js b/public/app/plugins/datasource/elasticsearch/datasource.js index 1d846a7be17..df1fd65f515 100644 --- a/public/app/plugins/datasource/elasticsearch/datasource.js +++ b/public/app/plugins/datasource/elasticsearch/datasource.js @@ -19,6 +19,7 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes function ElasticDatasource(datasource) { this.type = 'elasticsearch'; this.basicAuth = datasource.basicAuth; + this.withCredentials = datasource.withCredentials; this.url = datasource.url; this.name = datasource.name; this.index = datasource.index; @@ -38,8 +39,10 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes data: data }; - if (this.basicAuth) { + if (this.basicAuth || this.withCredentials) { options.withCredentials = true; + } + if (this.basicAuth) { options.headers = { "Authorization": this.basicAuth }; diff --git a/public/app/plugins/datasource/prometheus/datasource.js b/public/app/plugins/datasource/prometheus/datasource.js index 509b0ce9970..391affb0c8d 100644 --- a/public/app/plugins/datasource/prometheus/datasource.js +++ b/public/app/plugins/datasource/prometheus/datasource.js @@ -23,6 +23,7 @@ function (angular, _, moment, dateMath) { this.url = datasource.url; this.directUrl = datasource.directUrl; this.basicAuth = datasource.basicAuth; + this.withCredentials = datasource.withCredentials; this.lastErrors = {}; } @@ -32,8 +33,10 @@ function (angular, _, moment, dateMath) { method: method }; - if (this.basicAuth) { + if (this.basicAuth || this.withCredentials) { options.withCredentials = true; + } + if (this.basicAuth) { options.headers = { "Authorization": this.basicAuth };