Caddy Ha

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up caddy ha, you run two or more web servers behind a load balancer. These servers must share a single storage pool so they can sync TLS certificates and keys. Teams often start by placing a network load balancer in front of several server nodes. They point all nodes to a shared file system or a key-value store. When teams rush this setup, they often leave admin ports open or grant broad storage permissions. Overly broad roles let any single server read or change every secret in the shar

Ha: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

To set up caddy ha, you run two or more web servers behind a load balancer. These servers must share a single storage pool so they can sync TLS certificates and keys.

Teams often start by placing a network load balancer in front of several server nodes. They point all nodes to a shared file system or a key-value store. When teams rush this setup, they often leave admin ports open or grant broad storage permissions. Overly broad roles let any single server read or change every secret in the shared store.

How caddy ha works in a server cluster

A single web server handles TLS certificates on its own local disk without any trouble. When you add more servers for high availability, local disks cause immediate conflicts. Each server might try to request a new certificate from the issuer at the same time. This behavior quickly hits rate limits and breaks HTTPS traffic for your users.

In a caddy ha design, every server node points to the same external storage system. When one node needs to renew a certificate, it places a lock file in shared storage. Other nodes see this lock and wait instead of making duplicate requests to the certificate issuer. Once the first node finishes the renewal, it writes the new certificate to the shared store. Every other node in the cluster then reads the updated certificate from that same location.

You also need a consistent way to push routing updates to every server node at once. Most teams do this by sending updates to the admin API on each running instance. A deployment tool sends the new routing rules to all nodes during a release. If one node fails a health check, the load balancer stops sending user traffic to it.

What native clustering solves and what it misses

The native shared storage design solves uptime and certificate sync problems for web traffic. If one server crashes, the load balancer shifts traffic to the remaining healthy servers right away. Users do not see certificate errors because every node shares the same valid TLS keys. Your public web apps stay online even during hardware failures or routine server reboots.

Ha: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Still, this setup creates a big security gap around server administration and storage permissions. Every node in the cluster holds full read and write permissions to the certificate store. If an attacker compromises one node, they can read private TLS keys for every domain. Also, engineers often need direct access to the server nodes or the admin API to fix issues.

Native server permissions only check if a user or tool can log in to the host. They do not check what individual commands or API requests do while in flight. An engineer with admin access can accidentally delete a live route or expose sensitive private keys. Standard logs on the host also fail to link admin actions back to specific user identities. You know a rule changed, but you do not know who ran the command or why. Also, if staff query backend data through these servers, native settings will not rewrite PII like emails or card numbers in results.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.

Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.

Frequently asked questions

How do server nodes avoid certificate rate limits in a cluster?

All server nodes connect to a single shared storage backend to coordinate their tasks. One node sets a lock during renewal while the other nodes wait and read the finished certificate.

Can I use a local disk for a multi-node web server setup?

No, local disks do not sync state or lock files between separate machines. You must use a shared network file system or a supported database so all nodes share certificates.

How should teams update routing rules across multiple nodes?

Teams should use an automated deployment pipeline to push changes to the admin API on every node. This keeps all servers in sync and avoids manual edits on individual hosts.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.