Skip to content

Caddy

I just installed the apt version first so I wouldn't have to fuss with systemd

sudo apt install caddy

Then I downloaded a caddy binary with cloudflare-dns module already installed and copied it to /tmp/caddy on beelink.

Replaced original caddy binary with the newly downloaded one:

sudo systemctl stop caddy
sudo mv /tmp/caddy /usr/bin/caddy
sudo chmod +x /usr/bin/caddy
sudo systemctl start caddy

Made sure the module was there:

caddy list-modules | grep "cloudflare"

I already had a cloudflare api token that could edit DNS. Added it to the caddy systemd environment

sudo systemctl edit caddy
[Service]
Environment=CLOUDFLARE_API_TOKEN=your_token_here
sudo systemctl daemon-reexec

Then configured Caddyfile:

/etc/caddy/Caddyfile
mydomain.example.com {
    reverse_proxy localhost:8080

    tls {
        dns cloudflare {env.CLOUDFLARE_API_TOKEN}
    }
}

Restarted systemd service:

sudo systemctl restart caddy

And pointed my Cloudflare DNS record at the Tailscale IP for the node running Caddy.