XMLHttpRequest cannot load http://localhost/elasticservice/. Request header field kbn-version is not allowed by Access-Control-Allow-Headers in preflight response.
I checked the issue on several links. And from this, I understand that the Kibana is expecting some preflight token which would act as authentication token to use this service.
If so, then how to use preflight in kibana? and if 'NO', then what could be the issue?
Kibana uses the kbn-version and kbn-name headers to prevent XSRF attacks.
It looks to me like your webservice hasn't been configured to allow this header. I'm assuming your web service is running on a different port than Kibana, is that correct? If so, you'll have to configure your web service to allow the kbn-version and kbn-name headers.
I checked the same, however I am getting this error:
XMLHttpRequest cannot load http://localhost/elasticservice/. Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header contains multiple values 'kbn-name, kbn-version', but only one is allowed. Origin 'http://localhost:5601' is therefore not allowed access.
From, this I understand that I can only allow one Access-Control-Allow-Origin. And the previous code that I had:
header('access-control-allow-origin: *');
I understand that, this will allow any origin to send and receive the data.
There are two separate headers that are necessary here: access-control-allow-origin and access-control-allow-headers. You're currently setting access-control-allow-origin but I don't see anywhere you're setting access-control-allow-headers. It should look something like this:
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.