+ Start a Discussion

httprequest to https site still showing java error

I am having an issue with some Apex code for our AppExchange product called "EnlightenCRM". It uses an HTTPRequest to send messages to a user configured external site.

One of our customers has a site with SSL and our messages are getting an apex error.
The error is:
System.CalloutException: java.security.cert.CertificateException: No subject alternative DNS name matching connect.maximizedliving.com found.

From what I've read in forums it is possibly because Salesforce does not support SNI (server name indication). To get around this, the customer's host put their site on a unique IP address, rather than the shared IP it was on. However, the error is still occurring.

To reproduce the error, I used this code in the Developer Console:
HttpRequest httpReq = new HttpRequest();
Http httpObj = new Http();
HttpResponse httpResp = new HttpResponse();

httpResp = httpObj.send(httpReq);

return 1;
I removed the actual customer site from the example since this is a public forum.

I don't know why the error is still happening as everything with the certificate seems correct to me. Can you help me figure out why it's still causing this java error?

The explanations I have seen suggest to ensure:
-The certificate contains a DNS subject alternative name (this is a standard extension) entry matching the hostname
-the last CN of your subject distinguished name (this is the main name if you want) matches the hostname.

I have checked the certificate and both of these are correct, so I don't understand where the issue is.


Boris BachovskiBoris Bachovski
Have you created a remote site for that url? Setup -> Security Controls -> Remote Site Settings. Here you should create a new Remote Site for the domain that represents your endpoint. (Don't forget to activate it)