# \[HTTP check\] Override Host header

**URL:** <https://discuss.elastic.co/t/http-check-override-host-header/157660>\
**Category:** Beats\
**Tags:** heartbeat\
**Created:** [November 21, 2018, 9:21am UTC](https://discuss.elastic.co/t/http-check-override-host-header/157660 "2018-11-21T09:21:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexkl](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@Alexkl](https://discuss.elastic.co/u/Alexkl)\
**Post date:** [November 21, 2018, 9:21am UTC](https://discuss.elastic.co/t/http-check-override-host-header/157660/1 "2018-11-21T09:21:58Z")

</div>

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: ["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

Am i doing something wrong ?  
Thank you

---

<div class="post-metadata">

**Author:** ![Andrew\_Cholakian1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_cholakian1/32/3612_2.png) [@Andrew\_Cholakian1](https://discuss.elastic.co/u/Andrew_Cholakian1)\
**Post date:** [December 3, 2018, 11:01pm UTC](https://discuss.elastic.co/t/http-check-override-host-header/157660/2 "2018-12-03T23:01:24Z")

</div>

Apologies for the delay.

Unfortunately, as you've discovered, this does not work, partially due to the fact that the Go HTTP client treats the Host header as [a special field](https://github.com/golang/go/issues/7682#issuecomment-66093167).

If you could [open a feature request](https://github.com/elastic/beats/issues) issue on Github for this it'd be much appreciated. I think we should do this at some point, we can make this example work with some extra magic on our end.

---

<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 31, 2018, 11:01pm UTC](https://discuss.elastic.co/t/http-check-override-host-header/157660/3 "2018-12-31T23:01:25Z")

</div>

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