I do the same as you using Caddy.
To avoid downtime try using:
health_uri /health
lb_try_duration 30s
Full example: api.xxx.se {
encode gzip
reverse_proxy api:8089 {
health_uri /health
lb_try_duration 30s
}
}
This way, Caddy will buffer the request and give 30 seconds for your new service to get online when you're deploying a new version.Ideally, during deployment of a new version the new version should go live and healthy before caddy starts using it (and kills the old container). I've looked at https://github.com/Wowu/docker-rollout and https://github.com/lucaslorentz/caddy-docker-proxy but haven't had time to prioritize it yet.