Hello there,
Make sure the client access the server by using the subject specified in the server certificate. Normally the server certificates subject(CN) includes the Fully Qualified Name of the server, so the client should access the server using the same.
When SSL handshake happens client will verify the server certificate. In the verification process client will try to match the Common Name (CN) of certificate with the domain name in the URL. if both are different host name verification will fail. In your case certificate has CN as local host and when you try to invoke using IP address, it fails. When you create the cert you can have single host name / multiple host name / wild card host name as CN value.
Hope this resolves your Query !!
--If the reply is helpful, please Upvote and Accept it as an answer--