Interview Prep/Networking/TLS and certificate errors

`SSL: no alternative certificate subject name matches target host name 'api.example.com'`

BeginnerTroubleshootingTLS and certificate errors
Answer

Likely causes → The certificate's SAN list doesn't include the hostname used, you connected by IP, or the server returned its default certificate because SNI didn't match any vhost.

Diagnose →

echo | openssl s_client -connect api.example.com:443 -servername api.example.com 2>/dev/null \
  | openssl x509 -noout -ext subjectAltName

Fix → Issue a certificate that includes the name (wildcards cover one label only: *.example.com doesn't match a.b.example.com), or fix the vhost so it serves the right certificate.

Prevent → Generate SANs from the same config that defines hostnames.

All Networking questions Roadmap: Networking for DevOps

More on TLS and certificate errors