I supplied the CLOUDFLARE_EMAIL and CLOUDFLARE_API_KEY environment variables and downloaded the version of caddy with the plugin. Yet, I am receiving an error that caddy was unable to bind to port 80.
I thought using the DNS challenge meant that port 80 wouldn’t be required?
With your configuration, Caddy doesn’t need port 80 for certificate validation, no - but it’ll still try to serve your site on the standard HTTP and HTTPS ports, 80 and 443.
If you want it to use something different, you can specify scheme/port combinations Caddy should listen on in the site labels, e.g:
http://files.example.org:8080,
https://files.example.org:8443 {
tls {
dns cloudflare
}
}
I’m not sure why or how that wouldn’t work, unless there were other entries in your Caddyfile, but I’m glad you’ve got a working solution.
Automatic HTTPS is the feature responsible for the default HTTP->S redirect. You can override it by defining your own HTTP listener for the site in question (e.g. http://example.com), or alternatively disabling Automatic HTTPS.