1. The problem I’m having:
Note that this is quite similar to a previous answered question by me: HOW TO: Pass health_uri the specific upstream endpoint as a query parameter but I believe it’s different enough to warrant asking in a different way as this might be possible and I’m just not seeing how at this time. If this also doesn’t make sense, a simple No is fine so you don’t need to spend time responding.
Is there a way to reference an upstream during active health checks? Right now you can check what the Host header is during an active health check:
Host: 5.0.0.17:53336
which is great - but I’d like to use the original, full upstream rather than with the modified port. The original upstream being:
5.0.0.17:25857
Is there a way to pass that in as an argument to the active health check?
2. Error messages and/or full log output:
NA
3. Caddy version:
v2.8.2
4. How I installed and ran Caddy:
a. System environment:
Ubuntu 22.04, systemd
b. Command:
sudo systemctl start caddy.service
c. Service/unit/compose file:
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target
[Service]
Type=notify
User=caddy
Group=caddy
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile --force
TimeoutStopSec=5s
Restart=always
RuntimeMaxSec=43200
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
d. My complete Caddy config:
(active-lb) {
lb_policy ip_hash
lb_retries 2
health_uri /health
health_port 53336
health_interval 10s
health_timeout 15s
health_status 2xx
health_headers {
Full-Upstream {args[0]}
}
}
:1000 {
reverse_proxy 5.0.0.17:25857 5.0.0.17:25858 {
import active-lb upstream
}
}