I am trying to establish server client communication over SSL using self signed certificates. On server side, I added CN= while creating certificate. My Client is communicating using libCurl with CURLOPT_SSL_VERIFYPEER set to 1 and CURLOPT_SSL_VERIFYHOST set to 2.
When client tries to send request using server's FQDN in URL, it works fine. but if client uses IP address instead, I am getting error message as 'SSL: certificate subject name '' does not match target host name ''' I understood the problem is 'Hostname used in url should match with subject name' provided in certificate.
But what is the solution to this problem? Client should be able connect using IP address/short hostname/FQDN. I tried adding multiple CN entries(for FQDN and IP) in certificate but it didn't work.