Force.com Site: SSL exception javax.net.ssl.SSLPeerUnverifiedException

Situation

I enabled SSL for one of our Force.com Sites. The website is available and all SSL certs are working fine.

I noticed that SSL doesn’t work in case you are using getContent(). As you can see below I implemented a APEX Class:

public with sharing class SalesforceTestCase {
    public String content {get; set;}
    public SalesforceTestCase() {
        try
        {
        PageReference pr = new PageReference('/apex/MyPage');
        content = pr.getContent().toString();
        }
        catch(Exception e)
        {
            content = e.getMessage();
        }
    }
}

And in addition a Visualforce page to show the variable content.

<apex:page controller="SalesforceTestCase" showHeader="false" sidebar="false" standardStylesheets="false" >
    {!content}
</apex:page>

Test case

It works fine without HTTPS:

http://www.die-akademie.de/SalesforceTestCase

But in the moment you are using HTTPS the site fails:

https://www.die-akademie.de/SalesforceTestCase

Question

How can I fix this issue? Does it have anything to do with getContent()?

Answer

It has a very simple Solution.

For the site https://www.die-akademie.de/SalesforceTestCase upload SSL certificate which is CA signed. All other circuits are rejected by Salesforce or behave in unexpected way.

Error standard description:

When the peer was not able to identify itself (for example; no
certificate, the particular cipher suite being used does not support
authentication, or no peer authentication was established during SSL
handshaking) this exception is thrown.

issue

Attribution
Source : Link , Question Author : Christian Deckert , Answer Author : Ashwani

Leave a Comment