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:
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
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: ["htt…
Issue:
opened 10:06AM - 04 Dec 18 UTC
closed 05:33PM - 20 Dec 18 UTC
enhancement
Heartbeat
Team:obs-ds-hosted-services
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)
committed 05:33PM - 20 Dec 18 UTC
elastic:master
← K-Phoen:fix-host-header-definition
opened 10:00PM - 12 Dec 18 UTC
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:
elastic:6.x
← andrewvc:backport_9516_6.x
opened 06:08PM - 20 Dec 18 UTC
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:
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
1 Like