1. The problem I’m having:
I have configured Caddy to proxy a container running MeshCentral but it only works if Caddyfile has the “tls_insecure_skip_verify” option active for this transport. If I comment the “tls_insecure_skip_verify” option the site never loads and the error below appears in Caddy logs.
Interestingly, if “tls_insecure_skip_verify” command is let in/active the R3 issued SSL certificate shows “This certificate is valid” in all browsers and has an proper expiration date of 9/4/2024 so it is a valid certificate!
Also, MeshCentral seems to successfully load this valid certificate from Caddy since it’s logs show:
MeshCentral HTTP redirection server running on port 80.
MeshCentral v1.1.24, Hybrid (LAN + WAN) mode, Production mode.
MeshCentral Intel(R) AMT server running on mesh.example.com:4433.
Loaded web certificate from "https://172.22.0.5:443", host: "mesh.example.com"
SHA384 cert hash: 9001e831ffe6a0806607c987f3429129094ac087e04e1f86778955242648d7d7059bd5a4f223857689132203fa24b67d
MeshCentral HTTPS server running on mesh.example.com:443.
Why does the error in Caddy occur if the certificate is valid and loads successfully?
2. Error messages and/or full log output:
ERR | ts=1718595207.8516228 logger=http.log.error msg=tls: failed to verify certificate: x509: certificate is valid for mesh.example.com, localhost, not meshcentral request={"remote_ip":"192.168.1.199","remote_port":"55518","client_ip":"192.168.1.199","proto":"HTTP/2.0","method":"GET","host":"mesh.example.com","uri":"/","headers":{"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"],"Upgrade-Insecure-Requests":["1"],"Sec-Fetch-User":["?1"],"Accept-Encoding":["gzip, deflate, br, zstd"],"Cookie":["REDACTED"],"Priority":["u=0, i"],"Sec-Ch-Ua":["\"Not/A)Brand\";v=\"8\", \"Chromium\";v=\"126\", \"Brave\";v=\"126\""],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8"],"Sec-Fetch-Site":["none"],"Sec-Fetch-Mode":["navigate"],"Cache-Control":["max-age=0"],"Sec-Ch-Ua-Platform":["\"macOS\""],"Sec-Gpc":["1"],"Accept-Language":["en-US,en;q=0.8"],"Sec-Fetch-Dest":["document"],"Sec-Ch-Ua-Mobile":["?0"]},"tls":{"resumed":true,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"mesh.example.com"}} duration=0.004046964 status=502 err_id=z8mn70msv err_trace=reverseproxy.statusError (reverseproxy.go:1269)
3. Caddy version:
caddy v2.8.4
4. How I installed and ran Caddy:
a. System environment:
Ubuntu Server
Docker
Docker compose v2
Portainer
b. Command:
n/a
c. Service/unit/compose file:
d. My complete Caddy config:
mesh.example.com {
reverse_proxy {
to https://meshcentral:443
transport http {
tls
# tls_insecure_skip_verify
}
}
}