1. Caddy version (caddy version
):
Caddy 2.4.5
2. How I run Caddy:
start caddy with json config
a. System environment:
Plain linux
b. Command:
Paste command here.
c. Service/unit/compose file:
Paste full file contents here.
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane.
d. My complete Caddyfile or JSON config:
{
"logging": {
"logs": {
"default": {
"level": "debug"
}
}
},
"admin": {
"disabled": false,
"listen": "0.0.0.0:2019"
},
"apps": {
"http": {
"servers": {
"example": {
"listen": [
":2015"
],
"experimental_http3": true,
"routes": [
{
"handle": [
{
"handler": "reverse_proxy",
"transport": {
"protocol": "http",
"tls": {
"server_name": "httpbin.org"
}
},
"upstreams": [
{
"dial": "httpbin.org:443"
}
],
"headers": {
"request": {
"set": {
"Host": [
"{http.reverse_proxy.upstream.hostport}"
]
}
}
},
"health_checks": {
"active": {
"uri": "/aa",
"expect_status": 200,
"expect_body": "",
"interval": "10s",
"timeout": "5s",
"headers": {
"Host": [
"httpbin.org"
]
}
}
}
}
]
}
]
},
"example2": {
"listen": [
":2016"
],
"experimental_http3": true,
"routes": [
{
"handle": [
{
"handler": "reverse_proxy",
"transport": {
"protocol": "http",
"tls": {
"server_name": "httpbin.org"
}
},
"upstreams": [
{
"dial": "httpbin.org:443"
}
],
"headers": {
"request": {
"set": {
"Host": [
"{http.reverse_proxy.upstream.hostport}"
]
}
}
},
"health_checks": {
"active": {
"uri": "/",
"expect_status": 200,
"expect_body": "",
"interval": "10s",
"timeout": "5s",
"headers": {
"Host": [
"httpbin.org"
]
}
}
}
}
]
}
]
}
}
}
}
}
3. The problem I’m having:
In the config you see that i have two servers, one on port 2015, the other 2016. both use the revers-proxy setting for httpbin.org
the first one does a health_check for the path “/aa” which is illegal on httpbin.org and returns a 404. if i only have this server, i get an error (for the healthcheck, which is ok). but as you can see, i have a second server on port 2016 and this has a health_check to “/” and this is ok.
the result is, that both servers are healthy although the first should be unhealthy.