Automatic SSL with Caddy, Cloudflare and Let’s Encrypt

I run a lot of applications and services in my homelab, and they usually look something like http://10.10.10.10:8000, http://10.10.10.11:8006, and so on. It works, but it comes with a few annoyances. Browsers constantly complain you about insecure connections, and remembering which IP and port maps to which service gets old fast.
The ideal setup is something like https://netbox-lab.yourdomain.com - a proper domain name with a valid SSL certificate and no port numbers to remember. In this post, I'll show you how to get there using Caddy, Cloudflare, and Let's Encrypt with very minimal effort.
Overview
To make this work, we need the following.
- A Cloudflare account with a domain (You don't necessarily need Cloudflare. Other DNS providers should work the same way, but this post uses Cloudflare as the example.)
- An LXC or VM to run Caddy
- A Cloudflare API token with DNS edit permissions
- Let's Encrypt Certificates are automatically managed by Caddy
Cloudflare Setup
I already have a domain that I use in my homelab, so I name my services like app.yourdomain.com. I purchased this domain through Cloudflare and manage it there.
To generate an API Continue reading




Breaking Changes & Deprecations
Key Feature Updates


