1. Caddy version (caddy version
):
2.4.6
2. How I run Caddy:
docker-compose
a. System environment:
b. Command:
caddy run --config /dockerapp/caddy/Caddyfile
c. Service/unit/compose file:
d. My complete Caddyfile or JSON config:
{
storage redis {
host {$REDIS_HOST}
}
on_demand_tls {
ask 0.0.0.0:3000/caddy-domain-check
interval 2m
burst 5
}
debug
}
(SecurityHeaders) {
header_up X-Real-IP {remote_host}
header_up X-Forwarded-Proto {scheme}
}
my-site.com, *.my-site.com {
@notStatic {
not file
}
reverse_proxy @notStatic web:3000
request_body {
max_size 100MB
}
log {
output stdout
}
tls me@my-site.com {
dns route53
}
}
:443, :80 {
@notStatic {
not file
}
reverse_proxy @notStatic web:3000
request_body {
max_size 100MB
}
tls {
on_demand
}
}
3. The problem I’m having:
Thank you for this awesome software! I’m migrating from nginx specifically for Caddy’s ability to issue TLS certs on demand for custom domains and custom subdomains. It’s working perfectly for on demand custom subdomains (eg. testing.my-client.com or www.my-client.com), but I’m at a loss for how to configure Caddy + DNS settings so that Caddy can handle the apex domain (eg. my-client.com)
For the custom subdomain, I create a CNAME record going from test.my-client.com to client-subdomain.my-site.com. This is working great!
But when it comes to handling the apex domain, domain registrars generally don’t let you create CNAME records for the apex domain. I’ve seen other services handle this by telling their clients to create an A record for the apex domain pointing to an IP (presumably some sort of proxy).
But I don’t fully understand the inner-workings of this method - and I’m wondering if there’s a simpler way to do this with Caddy?
4. Error messages and/or full log output:
5. What I already tried:
I’ve tried finding workarounds for creating CNAMEs for apex domains but it seems like a dead end at this point.
6. Links to relevant resources:
I’ve read every related thread I could find on this forum, including the comprehensive thread at Serving tens of thousands of domains over HTTPS with Caddy , but I’ve been unable to find an answer.