# Environment variable to configure elasticsearch.customHeaders for Kibana

**URL:** <https://discuss.elastic.co/t/environment-variable-to-configure-elasticsearch-customheaders-for-kibana/301304>\
**Category:** Kibana\
**Created:** [April 1, 2022, 10:06am UTC](https://discuss.elastic.co/t/environment-variable-to-configure-elasticsearch-customheaders-for-kibana/301304 "2022-04-01T10:06:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![duarnad](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@duarnad](https://discuss.elastic.co/u/duarnad)\
**Post date:** [April 1, 2022, 10:06am UTC](https://discuss.elastic.co/t/environment-variable-to-configure-elasticsearch-customheaders-for-kibana/301304/1 "2022-04-01T10:06:49Z")

</div>

Hello,

My goal is to configure elastic.customHeaders for basic auth from an environment variable.  
I have tried several combinations but it seems that I can't find the right one, and I wonder at what step in the parsing variable substitution is performed.  
The error message I have is the following:  
`FATAL Error: [elasticsearch.customHeaders]: expected value of type [object] but got [string]`  
With for example this configuration:

```auto
            - name: ELASTICSEARCH_CUSTOMHEADERS
              value: |-
                [{"Authorization": "Basic XXXXX"}]

```

I have also tried simpler ones as  
` value: '{"Authorization": "Basic XXXXX"}'`

Before using the 'all env variables ' way, I also tried with a kibana.yml in this way:  
`elastic.customHeaders: {"Authorization": "${KIBANA_TOKEN}"}`  
And then having an environment variable KIBANA\_TOKEN with the value, but this was also not working, this time more looking than no substiution was performed at all.

I am using kibana-oss:7.3.0

Regards,  
Arnaud

---

<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:** [April 29, 2022, 10:06am UTC](https://discuss.elastic.co/t/environment-variable-to-configure-elasticsearch-customheaders-for-kibana/301304/2 "2022-04-29T10:06:56Z")

</div>

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