Request header field kbn-version is not allowed by Access-Control-Allow-Headers in preflight response Errror when doing Rest Call in Kibana Plugin


(Ksuperman) #1

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);
            });

(Tanya Bragin) #2

Is this still happening? If so, you might consider jumping on IRC during North America business hours to chat with Kibana devs live about troubleshooting this. There are some plugin development resources here, and as you see IRC is the best way to get help: https://github.com/elastic/kibana/wiki/Plugin-Resources


(Veer Shubhranshu Shrivastav) #3

Hi Tanya,

I am also facing the same issue. Did the team find any fix for the issue?


(system) #4