Hello all,
I have a problem when making a rest API Call to external URL inside a custom visualization plugin, where i keep getting this error.
I have CORS enabled on the Node server where this call is being directed.
Any help resolving this would be appreciated. Also if there is another way of making rest call in Kibana Plugin Please let me know of that as well.
Error In Chrome Console
> XMLHttpRequest cannot load http://localhost:3000/test. Request header field kbn-version is not allowed by Access-Control-Allow-Headers in preflight response.
Code Causing this Issue.
var data = $.param({
fName: $scope.firstName,
lName: $scope.lastName
});
var config = {
headers : {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
}
}
$http.post('http://localhost:3000/test', data, config)
.success(function (data, status, headers, config) {
console.log(data);
})
.error(function (data, status, header, config) {
console.log("Error!!!");
console.log(data);
});