# Heartbeat http monitor is not sending headers

**URL:** <https://discuss.elastic.co/t/heartbeat-http-monitor-is-not-sending-headers/175761>\
**Category:** Beats\
**Tags:** heartbeat\
**Created:** [April 8, 2019, 5:58am UTC](https://discuss.elastic.co/t/heartbeat-http-monitor-is-not-sending-headers/175761 "2019-04-08T05:58:42Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![martinr\_ubi](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@martinr\_ubi](https://discuss.elastic.co/u/martinr_ubi)\
**Post date:** [April 10, 2019, 3:19am UTC](https://discuss.elastic.co/t/heartbeat-http-monitor-is-not-sending-headers/175761/4 "2019-04-10T03:19:26Z")

</div>

Hi @marvnz ,

This is a known bug/undocumented limitation of heartbeat \< v6.7.0.  
Specifically, the "host" header is ignored, it comes from GO, see below.

Originally reported:

> [@\[HTTP check\] Override Host header](https://discuss.elastic.co/t/http-check-override-host-header/157660):
>
> Hello, I have troubles overriding the Host header. I want to test individually: My CDN My varnish My backend To do that i need to check the IP with a custom Header, if i had to script it i would use Curl: curl -I -H "Host:my\_superb\_domain\_name.com" [http://IPCDN/myasset.json](http://IPCDN/myasset.json) curl -I -H "Host:my\_superb\_domain\_name.com" [http://IPvarnish/myasset.json](http://IPvarnish/myasset.json) curl -I -H "Host:my\_superb\_domain\_name.com" [http://IPbackend/myasset.json](http://IPbackend/myasset.json) So i tried to do something like that: - type: http urls: ["htt…

Issue:

> <https://github.com/elastic/beats/issues/9376>
>
> Hello
> 
> \*\*Describe the enhancement:\*\*
> I should be abled to override the Host h…eader to test my services.
> At the beginning i thought i did something wrong but Mr Cholakian told me to ask for a feature request: https://discuss.elastic.co/t/http-check-override-host-header/157660
> 
> \*\*Describe a specific use case for the enhancement or feature:\*\*
> I want to test individually:
> 
> My CDN
> My varnish
> My backend
> To do that i need to check the IP with a custom Header, if i had to script it i would use Curl:
> 
> curl -I -H "Host:my\_superb\_domain\_name.com" http://IPCDN/myasset.json
> curl -I -H "Host:my\_superb\_domain\_name.com" http://IPvarnish/myasset.json
> curl -I -H "Host:my\_superb\_domain\_name.com" http://IPbackend/myasset.json
> So i tried to do something like that:
> 
> \- type: http
> urls: \["http://IPCDN/myasset.json","http://IPvarnish/myasset.json","http://IPbackend/myasset.json"\]
> check.request:
> method: GET
> headers:
> accept-encoding: gzip,deflate
> host: my\_superb\_domain\_name.com
> 
> The Host header is not used, so i get a 404 or a 403 depending of the default behavior of my cdn/varnish/backend
> 
> It would be nice to be able to do so :)
> Have a good day
> 
> PS: Heartbeat.... not metricbeat of course

fix: (commit and pull)

> <https://github.com/elastic/beats/commit/893fdcb8b4471a6cee1c717d73f5f63d445931a3>

> <https://github.com/elastic/beats/pull/9516>
>
> As explained on \[golang's repository\](https://github.com/golang/go/issues/7682),… adding a \*Host\* header to the request's headers list isn't enough. So when this header is defined by the configuration, I also explicitly give it to the HTTP request.

Backport to 6.7.0:

> <https://github.com/elastic/beats/pull/9728>
>
> Cherry-pick of PR #9516 to 6.x branch. Original message: 
> 
> As explained on \[gola…ng's repository\](https://github.com/golang/go/issues/7682), adding a \*Host\* header to the request's headers list isn't enough. So when this header is defined by the configuration, I also explicitly give it to the HTTP request.

I myself didn't figure it out until I pointed heartbeat to a local netcat and figured that only the "host" header was silently ignored by heartbeat.  
`nc -kl 8888`

My struggle:

> [@Heartbeat bug with fix in 7.x, if no backport... doc fix in 6.x?](https://discuss.elastic.co/t/heartbeat-bug-with-fix-in-7-x-if-no-backport-doc-fix-in-6-x/172377):
>
> Hi, I lost some time investigating why Heartbeat 6.6.2 (lastest stable) was not respecting the "Host" http header I was configuring in an HTTP monitor. I was using exactly what the doc was saying, etc. Turns out when I understood the issue was specific to a specific header.. "Host" and not to all http headers. I looked for a known or unknown bug and found: Question is: If this fix is not scheduled to be backported to older heartbeat, I would recommend a documentation fix for older versi…

Instant relief with 6.7.

Hoping this helps,

Martin

---

_[View the full topic](https://discuss.elastic.co/t/heartbeat-http-monitor-is-not-sending-headers/175761)._
