Cover both the www and the bare domain in the certificate on Caddy
Why it matters
The www and bare versions of the domain answer on HTTPS, but one of them is served with a certificate that is not issued for it. Visitors who type or follow that version see a security warning.
The fix
- List both names as site addresses so Caddy obtains a certificate that covers them, and redirect one to the other if you want a single canonical name.
Caddyfile
www.example.com { redir https://example.com{uri} permanent } example.com { # your site configuration }
The examples use example.com. Replace it with your own domain.
Related
Scan your domain to see whether this applies to you.