# Kibana Plugin Development: Any way to access the headers?

**URL:** <https://discuss.elastic.co/t/kibana-plugin-development-any-way-to-access-the-headers/185399>\
**Category:** Kibana\
**Created:** [June 12, 2019, 11:35am UTC](https://discuss.elastic.co/t/kibana-plugin-development-any-way-to-access-the-headers/185399 "2019-06-12T11:35:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dasko](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@Dasko](https://discuss.elastic.co/u/Dasko)\
**Post date:** [June 12, 2019, 11:35am UTC](https://discuss.elastic.co/t/kibana-plugin-development-any-way-to-access-the-headers/185399/1 "2019-06-12T11:35:53Z")

</div>

Hey,

I'm currently working on a Kibana Plugin, and would like to know if there is any way to access the headers that have been sent to Kibana?

We are using an external SSO platform that uses two custom headers that are used to grant access rights or not. Would there be any way retrieve them from the plugin?

Cheers

---

<div class="post-metadata">

**Author:** ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)\
**Post date:** [June 12, 2019, 1:07pm UTC](https://discuss.elastic.co/t/kibana-plugin-development-any-way-to-access-the-headers/185399/2 "2019-06-12T13:07:05Z")

</div>

Hey @Dasko,

This is subject to change, as Kibana is currently undergoing a major restructuring to a new plugin architecture, but for now, you should be able to do something like this:

```auto
// Request interceptor, runs on every incoming request
server.ext('onRequest', async (request, h) => {
      const headers = request.headers;

      doSomethingWithHeaders(headers);

      return h.continue;
});

```

`onRequest` is part of Hapi's request lifecycle. Details on that can be found in their docs here: [https://hapijs.com/api#request-lifecycle](https://hapijs.com/api#request-lifecycle)

---

<div class="post-metadata">

**Author:** ![Dasko](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@Dasko](https://discuss.elastic.co/u/Dasko)\
**Post date:** [June 12, 2019, 1:50pm UTC](https://discuss.elastic.co/t/kibana-plugin-development-any-way-to-access-the-headers/185399/3 "2019-06-12T13:50:42Z")

</div>

Thank you @Larry_Gregory!

I had no idea I could do that, I will look into Hapi. Thank you for your fast answer, it is much appreciated.

---

<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 10, 2019, 1:50pm UTC](https://discuss.elastic.co/t/kibana-plugin-development-any-way-to-access-the-headers/185399/4 "2019-07-10T13:50:44Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
