# Unable to set host header using standard HTTP options

**URL:** <https://discuss.elastic.co/t/unable-to-set-host-header-using-standard-http-options/210212>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [December 2, 2019, 3:57pm UTC](https://discuss.elastic.co/t/unable-to-set-host-header-using-standard-http-options/210212 "2019-12-02T15:57:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![robcrawford](https://avatars.discourse-cdn.com/v4/letter/r/76d3ee/32.png) [@robcrawford](https://discuss.elastic.co/u/robcrawford)\
**Post date:** [December 2, 2019, 3:57pm UTC](https://discuss.elastic.co/t/unable-to-set-host-header-using-standard-http-options/210212/1 "2019-12-02T15:57:56Z")

</div>

Hello!

I'm using the prometheus metricbeat module and i'm trying to set the "Host" HTTP header for my target server. I'm using the [standard http options](https://www.elastic.co/guide/en/beats/metricbeat/master/configuration-metricbeat.html#module-http-config-options) to modify the headers.

Here's a snippet of my config:

```auto
- module: prometheus
  period: 10s
  hosts: ["http://metrics-host.example.com"]
  metrics_path: /metrics
  headers:
    Host: new-host.example.com
    X-Example-Header: test

```

My expected behaviour is that the "Host" header should be overridden, however that's not happening. The test header "X-Example-Header" works as expected.

Here's what the headers look like on the packet:

 ![metricbeat-bug](https://us1.discourse-cdn.com/elastic/original/3X/9/4/945b5e799ab0b2178dd0756236f58219443ec154.png)

I'm using Metricbeat 7.4.2 (running via the official Docker image).

Is this behaviour expected or is it a bug in metricbeat? If it's the latter i'll open an issue on the project.

Thanks!!

---

<div class="post-metadata">

**Author:** ![Kaiyan\_Sheng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kaiyan_sheng/32/38247_2.png) [@Kaiyan\_Sheng](https://discuss.elastic.co/u/Kaiyan_Sheng)\
**Post date:** [December 2, 2019, 10:20pm UTC](https://discuss.elastic.co/t/unable-to-set-host-header-using-standard-http-options/210212/2 "2019-12-02T22:20:29Z")

</div>

Thanks for posting here. This seems to be a bug to me. Please open a github issue for this and we will triage it later. Thank you!

---

<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:** [December 30, 2019, 10:20pm UTC](https://discuss.elastic.co/t/unable-to-set-host-header-using-standard-http-options/210212/3 "2019-12-30T22:20:35Z")

</div>

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