Caddy serving wrong SSL for subdomain

1. Caddy version (caddy version):


2. How I run Caddy:

caddy run --config /etc/caddy/Caddyfile

a. System environment:

Ubuntu 20

b. Command:

caddy run --config /etc/caddy/Caddyfile

c. Service/unit/compose file:

Paste full file contents here.
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane.

d. My complete Caddyfile or JSON config:

:80 {
    redir https://{host}{uri}

:443 {
    reverse_proxy localhost:2127
    encode gzip
    header /assets/* Cache-Control max-age=31536000
    tls {
    log {
        level DEBUG
        output file /var/log/caddy/access.log
} {
    reverse_proxy localhost:8081
    tls /etc/caddy/ssl/cfare.crt /etc/caddy/ssl/cfare.pem 

3. The problem I’m having:

I have auto SSL for wildcard domain so when I try to open this domain it tries to server the Cloudflare Certificate which is configured only for the domain as you can see into the config file.

when I disable the code block for the then stars working fine and uses the lets encrypt certificate.

4. Error messages and/or full log output:

No Logs showing

5. What I already tried:

I tried every method

6. Links to relevant resources:

Please upgrade to v2.4.6!

I think you need to configure this global option to make it ignore loaded certificates:

    auto_https ignore_loaded_certs

Not working same issue it still using the certificate from

What are the names on the certificate at /etc/caddy/ssl/cfare.crt? And what is your complete config, without redactions? Please don’t redact information, exact values are necessary here or we can’t look into this.


PS: Sorry for hiding the domain info. As this is my client’s server and forum is public so Google will index the client domain name which my client will never want it. That’s why I did that to prevent google to crawl the domain.

I have fixed it anyway. I have created a new certificate that is exclusive to the subdomain only. The previous certificate was the wildcard certificate.

But I still have one question when I included that certificate within the subdomain whether it’s a wildcard it should NOT apply to the other domain. Can you give some insight into this behavior?

I’d probably be able to if I had the exact domain names and certificate information. :confused: If you want to send us that privately, we can arrange paid support for your company rather than having to rely on free help in a public forum.

Thank you matt.

I will ask the client,

Can you send me the link from where he can buy the support plan ?

Yeah ^ Alternatively, a higher-tier sponsorship might be more in line with what you’re looking for.

This topic was automatically closed after 30 days. New replies are no longer allowed.