Caddy Load Balancer Configuration

Caddy's reverse_proxy directive supports multiple upstream backends out of the box. Generate a Caddyfile that distributes traffic evenly and fails over gracefully.

Multiple upstreams

List several upstreams in reverse_proxy and pick a policy.

example.com {
    reverse_proxy 10.0.0.1:8080 10.0.0.2:8080 {
        lb_policy least_conn
        health_uri /healthz
    }
}

Health checks are built in

Caddy supports active health checks with health_uri and health_interval, so failed backends leave rotation without extra software.

Open the Load balancer generator

Frequently asked questions

What is the default load balancing policy?

random. Set lb_policy to round_robin, least_conn, ip_hash and others as needed.

Guides