Trying to use Caddy behind Cloudflare (with caddy plugin), Caddy itself starts fine and listens on ports 443 and 80, but trying to load my-site-name.net fails on all browsers with error ERR_TOO_MANY_REDIRECTS.
My /etc/caddy/Caddyfile:
my-site-name.net
root /var/www/
tls {
dns cloudflare
}
My /etc/systemd/system/caddy.service.d/override.conf:
[Service]
Environment="CLOUDFLARE_EMAIL=my_email_address@gmail.com"
Environment="CLOUDFLARE_API_KEY=1234_my_cloudflare_global_api_key_4321"
When attempting to load the website with lynx
(in case this is useful):
$ lynx https://my-site-name.net
(â was prompted to accept cookie, selected Always
)
Looking up my-site-name.net
Making HTTPS connection to my-site-name.net
Verified connection to my-site-name.net (subj=my-site-name.net)
Certificate issued by: /C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO ECC Domain Validation Secure Server CA 2
Secure 128-bit TLS1.2 (ECDHE_ECDSA_AES_128_GCM_SHA256) HTTP connection
Sending HTTP request.
HTTP request sent; waiting for response.
HTTP/1.1 301 Moved Permanently
'A'lways allowing from domain '.my-site-name.net'.
Data transfer complete
HTTP/1.1 301 Moved Permanently
lynx: Start file could not be found or is not text/html or text/plain
Exiting...
As far as Iâm aware Iâm not trying to do anything spectacularly complex. I tried setting CLOUDFLARE_API_KEY to the key listed on cloudflare as âOrigin CA Keyâ but this prevented Caddy from running at all.
I also tried making a single label for my-site-name.net and nesting the rootdir and tls directives within in, but it made no difference.
Am at a bit of a loss.