Heartbeat http monitor is not sending headers

I have configured the following http monitor:

heartbeat.monitors:
- type: "http"
  urls: ["http://elasticsearch-dev-master.dev-common-cache.svc.cluster.local:9200","https://dev-common-cache.gubbins.bobbins","http://10.10.10.10:33101/"]
  schedule: "@every 10s"
  check.request.method: "GET"
  check.request.headers:
    HOST: 'dev-common-cache.gubbins.bobbins'
  check.response.body: "You Know, for Search"

These 3 urls all point to the same elasticsearch cluster, but just being reached through different network endpoints to try to establish they are all working.

However I don't think the headers are being sent through as the endpoint that goes through the nginx-ingress controller is not working as it requires that header to route the request. So my question is have I configured the http monitor correctly? Also I have enabled debug logging, but that doesn't show what the request looks like.

At first sight, your config looks correct. I stumbled over the HOST in upper-case. I assume that is intended?

As you already run it with the debug log, any chance you could share it?

I have tried it lower case and in single quotes, but always the same http 404.

I can curl the ingress controller with the HOST: header and it works, but heartbeat can not successfully send the header so it keeps getting a validate 404 Not Found error as you can see in the screenshot attached.

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:

Issue:

fix: (commit and pull)

Backport to 6.7.0:

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:

Instant relief with 6.7.

Hoping this helps,

Martin

1 Like

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