Is it possible to pass arbitrary headers to Elasticsearch from Kibana?


(Katy Moe) #1

Note that I've forked Kibana 4.3 and am very prepared to mess with the internals, so the answer to my question is almost certainly "yes", but I'm not sure how difficult it will be.

Our setup requires that we pass an Authorization header through from the Kibana request to Elasticsearch. As far as I can tell, out of the box Kibana 4.3 allows you to use things like basic auth, but not pass arbitrary headers.

Can anyone suggest a place to start in implementing this?


(Lukas Olson) #2

In Kibana currently, we forward authorization headers from the browser to Elasticsearch. You can see how we do this in https://github.com/elastic/kibana/blob/master/src/plugins/elasticsearch/lib/call_with_request.js. Hope that helps!


(Katy Moe) #3

Thanks, that's just what I was looking for!


(saisn) #4

The link seems to be broken. Can you please provide the right one.


(Tyler Smalley) #5

Here is the updated link: https://github.com/elastic/kibana/blob/024c816/src/core_plugins/elasticsearch/lib/cluster.js#L20

I have embedded the SHA to the commit to avoid this in the future.

Please note, that as of Kibana 5.2 accessing callWithRequest has changed. More than likely, this is the change you are looking for.

server.plugins.elasticsearch.callWithRequest

Becomes:

server.plugins.elasticsearch.getCluster('data').callWithRequest


(system) #6