Unable to set host header using standard HTTP options

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 to modify the headers.

Here's a snippet of my config:

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

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!!

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!

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