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
Thai HuynhThai Huynh 

Forcing SSL

Is there an easy way to always force Force.com Site to always default to HTTPS without any client side redirect. In the Apache world, you could simply do this using htaccess. Is there something similar?

 

Thanks

Niket SFNiket SF

Hello Thai,

    For the page there is one attribute i.e "ForceSSl" please make it as a true. and make sure you need to use HTTPS in URL when you are testing your functionality.

 If it helps please mark as solve so it will help other's also

 

Thanks 

Nik's

 

 

Skype Name = niket.chandane

Thai HuynhThai Huynh

forceSSL is not an attribute of a VF page. It's part of an apex:form tag. We're not submitting any forms but simply want to redirect users to https without any javascript redirection. 

Niket SFNiket SF

That can be done via redirecting in the Construction it self. You can check the Base URL in the action method on page load.

 

If it's Http then you can get the currect URL and directly redirect to the HTTP://current URL

 

 

Thai HuynhThai Huynh

Correct. I know that way of doing it. However, the entire site is using nice URL and SF unfortunately doesn't provide you with the actual path. For instance, the url /tag/billing becomes /apex/Portal?tag=billing using the method URL.getCurrentRequestUrl().toExternalForm()

. What I ended up doing is manually map each URL to its nice URL.