Setup and install Caddy Load Balancer on Ubuntu 24.04 in Azure, AWS of Google GCP. Use our Caddy image from any of the cloud marketplaces below. Caddy Load Balancer solution provides a powerful, secure, and flexible tool for managing web traffic across multiple backend servers. This load balance solution is ideal for organizations that need an easy-to-configure and highly effective reverse proxy.
Cloud Caddy Load Balancer IaaS
Caddy Load Balancer Azure
Deploy Caddy Load Balancer on Ubuntu 24.04 in Azure
Caddy Load Balancer AWS
Coming Soon..
Caddy Load Balancer GCP
Coming Soon..
Getting Started with Caddy Load Balancer
Once your Caddy server has been deployed, the following links explain how to connect to a Linux VM:
Once connected and logged in, the following section explains how to start using Caddy as a Load Balancer.
Step 1: Verify Caddy Installation
After deploying Caddy, confirm it’s installed correctly by running:
caddy version
Confirm Caddy service is running:
sudo systemctl status caddy
Step 2: Configure the Caddyfile for Load Balancing
Caddy makes it straightforward to set up load balancing with its reverse_proxy directive and flexible policies. This configuration improves performance and fault tolerance by distributing traffic across multiple backend servers.
The Caddyfile is where you define your load balancing setup. Caddy can distribute traffic across multiple backend servers using various load-balancing strategies (like round-robin, least connections, or first available). Here’s a basic configuration:
Open the Caddyfile:
sudo nano /etc/caddy/Caddyfile
2. Define the Load Balancing Setup:
Replace <yourdomain.com>, server1, and server2 with your actual domain and backend servers.
If you’re using a public domain, Caddy will automatically obtain SSL certificates from Let’s Encrypt. Ensure your DNS is set up to point to the server running Caddy.
Step 4. Restart Caddy to Apply Changes
After saving your configuration, restart Caddy to apply the changes:
sudo systemctl reload caddy
Step 5. Testing the Load Balancer
Method 1: Use curl
Run curl requests to your domain and confirm that Caddy routes them to different backend servers:
curl -I http://
Look at response headers or logs on the backend servers to confirm that traffic is being distributed as expected.
Method 2: Monitor Server Logs
Each backend server should log incoming requests. By comparing the logs across servers, you can see if Caddy is distributing traffic evenly.
Method 3: Load Testing (Optional)
For more comprehensive testing, use a load-testing tool like Apache Benchmark (ab) or wrk:
ab -n 100 -c 10 http:///
This command sends 100 requests with a concurrency of 10, letting you verify how Caddy handles traffic distribution under load.
Additional Options
Health Checks: Use lb_health_path to specify a health-check path. Caddy will periodically check this path and avoid sending requests to any backend that’s unavailable.
lb_health_path /health
Timeout Settings: Adjust lb_try_duration and lb_try_interval to control retry behavior.
Caddy Documentation / Support
For further details and documentation refer to the following:
Check Caddy logs (usually found in /var/log/caddy/) to check for any errors.
If you’re having any issues with deployment please contact us for support.
Firewall Ports
For a Caddy load balancer setup with reverse proxy, the following ports are typically required:
Port 80 (HTTP):
Used to receive and handle unencrypted HTTP requests. If HTTPS is enabled, Caddy will redirect HTTP requests on port 80 to HTTPS on port 443.
2. Port 443 (HTTPS):
Used for secure, encrypted HTTPS connections. If Caddy’s automatic HTTPS is enabled, Caddy will use this port to serve content over SSL/TLS.
3. Backend Server Ports:
The ports your backend servers are listening on (e.g., 8080, 8081, etc.). Caddy will forward traffic to these ports as per the load balancing setup in the Caddyfile.
The links below explain how to modify / create firewall rules depending on which cloud platform you are using.
Disclaimer: Caddy® is a registered trademark of Light Code Labs, LLC and is licensed under Apache License 2.0 license. The license comes with a “no warranty” clause, meaning the software is provided “as-is” without any guarantees or liability for issues that may arise.
Cloud Solution Architect. Helping customers transform their business to the cloud. 20 years experience working in complex infrastructure environments and a Microsoft Certified Solutions Expert on everything Cloud.