I have a java application running as an Azure App Service. We would like this app to be able to connect to an apache server running on a vm which is in the same vnet that the java application is integrated with. The app can communicate fine with this apache server over its public domain. However when changing to the private ip (e.g https:///path) I get the following error:
[INFO] org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https://<my private ip>/path": No subject alternative names present; nested exception is javax.net.ssl.SSLHandshakeException: No subject alternative names present
I've looked at this myself and I know this issue is due to Java not allowing it to connect because it's not using the domain listed in the ssl certificate.
Any suggestions on how to work around this without changing the certificate or making any changes to the java code? (For work reasons I am unable to modify the code of the java app itself)
I've tried adding the property -Dcom.sun.jndi.ldap.object.disableEndpointIdentification=true as suggested here to the startup command for the java application as seen below:
-Dcom.sun.jndi.ldap.object.disableEndpointIdentification=true
The error is still occurring. A colleague has also suggested using the hosts file but I don't think this is possible for Azure web apps.
Hope this is clear. Thanks