Hi there,
I am using Caddy as a reverse proxy to load-balance two php/nginx servers.
It works great, however I struggle to setup the health checks.
What I want to do is to deploy with minimum downtime. I want to update my two servers one at a time, and have Caddy automatically register when one of the servers is down, so it will redirect all other requests to the healthy instance.
I have setup the following Caddyfile:
www.example.com
log stdout
errors stdout
timeouts 1m
gzip
proxy / server1_ip server2_ip {
policy ip_hash
header_upstream Host {host}
health_check /
health_check_interval 1s
fail_timeout 10s
max_fails 5
}
However, it doesn’t really seem that the health checks are working, because Caddy keeps directing traffic to both servers, even though one of the servers is down.