use cert commonNames for endpoints to work around InvalidCertificateException

fix for issue #2052