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

**URL:** <https://discuss.elastic.co/t/is-it-possible-to-pass-arbitrary-headers-to-elasticsearch-from-kibana/40144>\
**Category:** Kibana\
**Created:** [January 26, 2016, 5:29pm UTC](https://discuss.elastic.co/t/is-it-possible-to-pass-arbitrary-headers-to-elasticsearch-from-kibana/40144 "2016-01-26T17:29:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kmoe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kmoe/32/7386_2.png) [@kmoe](https://discuss.elastic.co/u/kmoe)\
**Post date:** [January 26, 2016, 5:29pm UTC](https://discuss.elastic.co/t/is-it-possible-to-pass-arbitrary-headers-to-elasticsearch-from-kibana/40144/1 "2016-01-26T17:29:08Z")

</div>

_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?

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [January 28, 2016, 4:48pm UTC](https://discuss.elastic.co/t/is-it-possible-to-pass-arbitrary-headers-to-elasticsearch-from-kibana/40144/2 "2016-01-28T16:48:54Z")

</div>

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](https://github.com/elastic/kibana/blob/master/src/plugins/elasticsearch/lib/call_with_request.js). Hope that helps!

---

<div class="post-metadata">

**Author:** ![kmoe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kmoe/32/7386_2.png) [@kmoe](https://discuss.elastic.co/u/kmoe)\
**Post date:** [January 29, 2016, 2:11pm UTC](https://discuss.elastic.co/t/is-it-possible-to-pass-arbitrary-headers-to-elasticsearch-from-kibana/40144/3 "2016-01-29T14:11:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![saisn](https://avatars.discourse-cdn.com/v4/letter/s/c5a1d2/32.png) [@saisn](https://discuss.elastic.co/u/saisn)\
**Post date:** [January 23, 2017, 11:59pm UTC](https://discuss.elastic.co/t/is-it-possible-to-pass-arbitrary-headers-to-elasticsearch-from-kibana/40144/4 "2017-01-23T23:59:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tylersmalley](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tylersmalley/32/8833_2.png) [@tylersmalley](https://discuss.elastic.co/u/tylersmalley)\
**Post date:** [January 24, 2017, 12:08am UTC](https://discuss.elastic.co/t/is-it-possible-to-pass-arbitrary-headers-to-elasticsearch-from-kibana/40144/5 "2017-01-24T00:08:06Z")

</div>

Here is the updated link: [https://github.com/elastic/kibana/blob/024c816/src/core\_plugins/elasticsearch/lib/cluster.js#L20](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`

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:33pm UTC](https://discuss.elastic.co/t/is-it-possible-to-pass-arbitrary-headers-to-elasticsearch-from-kibana/40144/6 "2017-07-06T13:33:19Z")

</div>


