0

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

  • *"The app can communicate fine with this apache server over its public ip."* - over its public IP address or by using its public domain name? This can be very different since only in the latter case the expected domain name is send to the server which then can choose the matching certificate. And this is not possible if your use the private IP address. – Steffen Ullrich Nov 30 '20 at 20:28
  • Sorry yes the public domain name - my mistake - I've changed in the main body – itadvice887 Dec 01 '20 at 10:02
  • You need to use the hostname in your app. In order to map it to the local IP for this host name instead of the public one you need to use a specific DNS resolver. See [Azure Private DNS](https://learn.microsoft.com/en-us/azure/dns/private-dns-overview) and [Is it possible to create the equivalent of a hosts file in an azure web app](https://stackoverflow.com/questions/57108772/is-it-possible-to-create-the-equivalent-of-a-hosts-file-in-an-azure-web-app). – Steffen Ullrich Dec 01 '20 at 16:37

0 Answers0