I have configured Caddy with my own tls certificates that had been created using Let's Encrypt.
This is the config file:
dev.???.com:443 {
tls /etc/caddy/server.cert /etc/caddy/server.key
reverse_proxy localhost:4000
}
Why is Caddy trying to obtain a new certificate!?
caddy | 2020/05/17 11:07:14 [INFO] [dev.???.com] acme: Obtaining bundled SAN certificate given a CSR
caddy | 2020/05/17 11:07:14 [INFO] [dev.???.com] AuthURL: https://acme-v02.api.letsencrypt.org/acme/authz-v3/4638262435
caddy | 2020/05/17 11:07:14 [INFO] [dev.???.com] acme: use tls-alpn-01 solver
caddy | 2020/05/17 11:07:14 [INFO] [dev.???.com] acme: Trying to solve TLS-ALPN-01
caddy | 2020/05/17 11:07:15 http: TLS handshake error from 127.0.0.1:45650: EOF
caddy | 2020/05/17 11:07:15 [INFO] Deactivating auth: https://acme-v02.api.letsencrypt.org/acme/authz-v3/4638262435
caddy | 2020/05/17 11:07:16 [ERROR] error: one or more domains had a problem:
caddy | [dev.???.com] acme: error: 400 :: urn:ietf:params:acme:error:dns :: No valid IP addresses found for dev.???.com, url:
caddy | (challenge=tls-alpn-01 remaining=[])
caddy | 2020/05/17 11:07:16 [INFO] Unable to deactivate the authorization: https://acme-v02.api.letsencrypt.org/acme/authz-v3/4638262435
caddy | 2020/05/17 11:07:18 [ERROR] attempt 1: [dev.???.com] Obtain: [dev.???.com] error: one or more domains had a problem:
caddy | [dev.???.com] acme: error: 400 :: urn:ietf:params:acme:error:dns :: No valid IP addresses found for dev.???.com, url:
caddy | - retrying in 1m0s (9.032151135s/720h0m0s elapsed)...
The certificates were created with Let's Encrypt, and they are valid, I can use them using any other webserver.
Note: part of the real domain name is anonymized with '???'.
I'm using Caddy Docker image caddy:2.0.0.
I have found that the certificates must be in the pem format.
After using the pem format, Caddy works as expected:
dev.???.com:443 {
tls /etc/caddy/server.pem /etc/caddy/server.pem
reverse_proxy localhost:4000
}
where is the default place Caddy v2 put the certificates files from automatic HTTPS
@lemchen The data directory: https://caddyserver.com/docs/conventions#file-locations