Tuesday, 13 August 2019

Custom domain setup for salesforce site:

Background:
We have an existing integration with a non-SF web application where user have their own login accounts and from their dashboard, they have “manage” link to update their own info.

once they click on “manage” link the request is handover to a salesforce and open a custom page, which hosted on a salesforce site. In this case, cookies used to pass through the URL parameters has all relevant details .

Problem Statement :
In above  case, cookies has passed  through parameters, which is not a secured way to communicate ,  end user may  keep copy the site URL (static)and re-use it in future. 

To solve this problem we need custom domain setup where a non-SF web application and salesforce custom page both would be under same domain and cookies would transfer through browser and not through parameters in URL.

Therefore, it would be more secure way to communicate as  compare to previous approach.
Here cookies will be available automatically only when both application pages will open within same domain.

By default, any salesforce site pages opened in force.com domain and using custom domain setup, we can change that default behavior.

 Hope I am making sense and this is one of the cool feature, which is unknown for many folks.

 Let us setup our custom domain for salesforce site !!

 There are several ways to set up a custom domain in Salesforce, For this setup, we’ll use the following example: say we own  https://abc.com , which is hosted through Hosting Company ,now  we want salesforce site URL to be https://example.abc.com or  https://example.abc.com/customerlanding .


Step 1: Create a CNAME entry in DNS


First, make sure you own the domain and you’re logged into the correct hosting company where the domain is registered. In the account management settings of DNS provider, create a CNAME(canonical name) record. CNAME records must include the given domain name, 18–character organization ID, and the suffix live.siteforce.com.

For example, if domain name is https://abc.com  and salesforce organization ID is 00dx00000000001aaa, then the CNAME must be example.abc.com.00dx00000000001aaa.live.siteforce.com(exclude www /https)



NOTE: Depending on your DNS provider, CNAME propagation can take up to 48 hours.



Step 2: Create the Custom Domain in Salesforce


  • Log into your production Salesforce org
  • Go to Setup > Domains
  • Click New Custom URL

Add caption


·         Initially chose option (4) domain over https (without certificate) and click save.
Step 3: Map salesforce site with created custom domain

  
After completing step-2 , click on the domain URL  and we will see below details.

Now click on new custom URL and select the site via lookup icon. For the path, it should typically be “/” if no absolute path required. In this case, path would be “customerlanding” as we want that in domain URL. lets follow bellow steps: 

  • Go to Setup > Domains and select your new domain
  • Under the Custom URLs section, click the Site Label (see below)
  • Now under Custom URLs click Edit next to your custom domain
  • Then click the checkbox for Site Primary Custom URL, then click Save


Now, our site should be set up with the new custom domain!


How to test and make sure it is working?
As I mentioned above , first test the setup without certificate. If it works, then test the domain configuration with https. Prior to test make sure salesforce site configuration parameter should have “https” access as false (highlighted with yellow).


if something went wrong with the domain entry we can check with same on below link to make sure domain is properly setup or not  :-



Step 4: Setup SSL Certificate in Salesforce


After successful test ,please go through the below steps to setup certificate for our domain.
  • Log into your production Salesforce org
  • Go to Setup > Certificate and Key Management
  • Click Create CA-Signed Certificate
  • All of these fields on this page would be relevant to your company except for the Key Size , which that should remain as 2048. Also, you will be selecting this Certificate via the Label Name in the next step
  • Click Save after all fields are filled out
  • Now click Upload Signed Certificate then Choose File and navigate to the certificate we acquired

Now we should go back to step2, change the option with HTTPS and upload the signed certificate in domain configuration. please make sure site configuration parameter also set with “HTTPS”.

 Now we all set! Salesforce site should be ready with the new custom domain!

Important Consideration: ** Custom Web addresses are not supported for Sandbox or Developer Edition organizations, so all test need to be performed in production

Getting started with Heroku

I am familiar with the heroku for quite long time, have seen lots of people are interested with it but not sure from where its need to Start...