-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTP Healthcheck not sending Host header #15308
Comments
Hi @SamMousa! I gave this a try myself and I wasn't able to confirm what you're seeing. Here's the jobspec I used: jobspecjob "example" {
datacenters = ["dc1"]
group "web" {
network {
mode = "bridge"
port "www" {
to = 8001
}
}
service {
port = "www"
check {
name = "status endpoint"
type = "http"
path = "/index.html"
interval = "5s"
timeout = "1s"
method = "GET"
header {
Host = ["my.host"]
User-Agent = ["Nomad"]
}
}
}
task "http" {
driver = "docker"
config {
image = "busybox:1"
command = "nc"
args = ["-lvp", "8001"]
ports = ["www"]
}
}
}
} And here's the logs from that allocation:
Can you share more of your jobspec, and which version of Consul you're using? Maybe there's a regression between versions here, or I'm missing some other piece of the puzzle. |
Sorry for not being more explicit. I'm using a nomad native service; no consul |
Seems with the Go net/http client, we need to set the |
Fixed in my first ever PR to Nomad and in the Go language. |
Fixed by #15337, which will ship in the next regular version of Nomad (likely 1.4.4) |
I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues. |
Nomad version
v1.4.2
Operating system and Environment details
Ubuntu 22.0.4.1
Issue
In a multi-host web app I noticed the status check never turned to healthy. Upon debugging I found that the status endpoint is returned a 404 because there was no
Host
header.I then proceeded to configure custom headers like this:
Note the modified user agent; I added this to confirm that headers are being added. The received request however looks like this:
Reproduction steps
Configure a health check with custom host header
Expected Result
I expect all the configured headers to be sent
Actual Result
Host header is not sent
The text was updated successfully, but these errors were encountered: