I think I figured it out. First I realized that I needed to allow Cloudflare into Caddy.
If someone from Caddy sees this, you may want to update your documentation as it took a random 3rd party site to learn how to install the Cloudflare module. Since I’m just using Caddy installed in an Ubuntu VM, there wasn’t much out there nor was it easy to find.
sudo caddy add-package github.com/caddy-dns/cloudflare
That’s very important.
Then I did what I already knew how to do and create a Cloudflare token which I insert into the ‘systemctl edit caddy’ file.
Following all of that, Calibre-web was still having the same issues.
What finally worked was setting the trusted proxies within the reverse proxy section for calibre web.
library.domain.tld {
reverse_proxy 172.16.120.12:8083 {
header_up X-Scheme https
trusted_proxies 173.245.48.0/20 103.21.244.0/22 103.22.200.0/22 103.31.4.0/22 141.101.64.0/18 108.162.192.0/18 190.93.240.0/20 188.114.96.0/20 197.234.240.0/22 198.41.128.0/17 162.158.0.0/15 104.16.0.0/13 104.24.0.0/14 172.64.0.0/13 131.0.72.0/22
}
}
I don’t know if the Cloudflare module was fully required or now, but it’s working now after adding the trusted proxies section.
For us homelabbers only, being able to set trusted proxies as a global option might be nice. I’m sure once I’ve used Caddy for a long time, I’ll learn the better way to go, but for now, it’s been really difficult as a beginner.