5

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()?

1

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

  • Hey thanks for your comment. You are right. Except: The certificate is CA signed. This can be simply verified by acting the page die-akademie.de/SalesforceTestCase. The certificate was signed by AlphaSSL. – Christian Deckert Jul 24 '15 at 14:34
  • @ChristianDeckert did you try accessing the site in browser. I got error as shown in answer. – Ashwani Jul 24 '15 at 17:09
  • which android version? And which device? – Christian Deckert Jul 24 '15 at 23:29
  • ChristianDeckert it is Android 5.0.1 running on Samsung Galaxy Note 4. – Ashwani Jul 25 '15 at 1:18
  • @ChristianDeckert Did you ever figure this out? I'm experiencing the same issue. PageReference getContent seems to fail when using a custom SSL certificate, even when it is CA-Signed. – zachelrath Feb 28 '18 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.