I've turned off the auto_https of caddy and set up three virtual hosts on caddy. Then I encountered an similar error like #3572 weeks ago.
The full caddyfile looks like this:
{
auto_https off
}
http://example.com {
bind 10.0.0.1
redir https://example.com{uri} permanent
}
https://example.com {
bind 10.0.0.1
tls /path/to/cert.crt /path/to/cert.key
root * /var/www/html
file_server
}
http://example2.com {
bind 10.0.0.1
root * /var/www/html1
}
The caddy could server the virtual hosts normally.
caddy did not startup and failed with the following exception adapting config using caddyfile: hostname appears in more than one automation policy, making certificate management ambiguous: example.com (the error indicates it encountered some problem on example.com, not example2.com).
I've encountered the similar issue weeks ago in #3572 , which was solved by using the latest build from source code.
Link: https://github.com/caddyserver/caddy/issues/3572#issuecomment-657084401
That said, I think 7bfe5b6 is a relevant fix, so you can try the latest by building from source, or you can use the latest CI artifacts.
The caddy works well with the first two virtual hosts, but got the error above when I added the third virtual host. I've also tried to change the host of the third virtual host from http://example2.com to http://10.0.0.1 and http://example2.com:8080, the caddy just works well.
2.1.1 (build from the latest source code)
Duplicate of https://github.com/caddyserver/caddy/issues/3550 -- already fixed on master; v2.1.1 does not contain the fix.
Duplicate of #3550 -- already fixed on master; v2.1.1 does not contain the fix.
Hi. The caddy binary I used is the latest build from GitHub action (Cross-Build #12), not the binary download from the release.
The issue still occurs on the latest CI build.
Thanks for clarifying, I was confused when you said 2.1.1 as the version. (A specific commit is always requested otherwise. caddy version will give you that.)
I'll have to circle back on this next week or something at my next opportunity. In the meantime, do you have any idea what in the code is causing it? That will accelerate a fix.
Thanks for clarifying, I was confused when you said 2.1.1 as the version. (A specific commit is always requested otherwise.
caddy versionwill give you that.)I'll have to circle back on this next week or something at my next opportunity. In the meantime, do you have any idea what in the code is causing it? That will accelerate a fix.
Sorry, I don't know much about the certificate automation process of caddy, so I really have no idea which code caused those issues.
That's fine, it will just take longer to diagnose it and find a fix then. This is a good opportunity to learn something and help us out :)
Should be fixed in ff19bdd -- please give it a try!
Should be fixed in ff19bdd -- please give it a try!
Hi, the caddy works well with multi virtual hosts after using the latest build from GitHub actions!
Thanks!
Most helpful comment
Hi, the caddy works well with multi virtual hosts after using the latest build from GitHub actions!
Thanks!