function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ram4SFDCram4SFDC 

Customer Portal login issue after logout

We have created sites in salesforce to login into customer portal. After login, sites redirects the user to customer portal successfully. Once inside customer portal when the user clicks on Logout, the user is logged out and redirected to sites login page.All is fine untill here. After logout the user is redirected to http:// protocol. After this when user tries to login, the page does not react to click of the logon. Why is the user redirected to http:// rather than https:// when the login is via https://.

bvramkumarbvramkumar

Did you try logging out with the below?

 

<full https url of your customer portal> + '/secur/logout.jsp'?

Santhosh KumarSanthosh Kumar

That seems to be the default behaviour of salesforce force.com. One workaround is, you can add a controller to your site home page, and in the init action, redirect to secure page, if it is not already a secure page.

 

    public PageReference init() {
        String currentURL = Site.getCurrentSiteUrl();
        if (!startsWith(currentUrl, 'https://')) {
            return redirect(currentURL.replace('http://', 'https://'));
        }
        
        return null;
    }