[Plugin visualization] CORS policy error message with ElasticsearchJS


Hi guys,
I developed a kibana plugin visualization integrating elasticsearch-browser to comunicate with elasticsearch.
When I configure elasticsearch-browser with an angularJS application, if I try to ping my ES instance, in the console of my browser appared this errore message:

Access to XMLHttpRequest at '' from origin '' has been blocked by CORS policy: Request header field kbn-version is not allowed by Access-Control-Allow-Headers in preflight response

Why? How I do to resolve this problem?
Thank's in advance for the replies!


I resolved adding this in elasticsearch.yml

http.cors.enabled : true
http.cors.allow-origin : "*"
http.cors.allow-methods : OPTIONS, HEAD, GET, POST, PUT, DELETE
http.cors.allow-headers: "kbn-version, Origin, X-Requested-With, Content-Type, Accept, Engaged-Auth-Token"