This post was written by Solution Architect Brandon LaFave. It was last updated on 11/29/21.

Overview

When a Salesforce user implements a customer-facing Experience (Community) Site, they often want to have a custom domain instead of the salesforcedomain.force.com that comes standard with an Experience Site. This is, of course, a great option, but there are a few steps that need to be taken to ensure proper configuration.

In this post, we'll walk through an example to demonstrate how to set up a custom URL.

DNS Update

Let's say that you have a company called Sunshine Sports, and that you want to set up a customer-facing Experience Site. To match your branding, you want a custom domain for the Experience Site, rather than the URL that is generated by Salesforce. Specifically, you want to use "www.sunshinesports.com."

The first step is to create a CNAME record with the domain provider that points www.sunshinesports.com to a Salesforce URL. The URL is a combination of the desired domain (www.sunshinesports.com), the unique Salesforce Organization ID, and live.siteforce.com. The easiest way to obtain this URL is by opening Setup in Salesforce, searching for Domains, and then clicking on Add Domain.

To get really specific with our example, if Sunshine Sports' Production Organization ID is "XYZ," the URL that Sunshine Sports would use to point customer to "www.sunshinesports.com"is "www.sunshinesports.com.XYZ.live.siteforce.com"

Certificate

To secure a custom domain, Salesforce needs a single certificate combined with the intermediate and root certs.

Cert Background

Certs work in a chain of trust. The intermediate certificate plays a “chain of trust” between an end entity certificate and a root certificate. The root CA signs the intermediate root with its private key, which makes it trusted. Then the CA uses the intermediate certificate's private key to sign and issue end-user SSL certificates.

How to determine the chain

When you're given a series of certs, you can assign the order of the cert chain in the following way:

  1. Unzip the file containing the certs.
  2. In your OS, open the folder containing the certs. Then click on each cert, starting with the domain you're trying to certify, and press the spacebar. A preview of the cert will appear.
  3. Near the bottom of the cert, you'll see who signed it.
  1. Each file you click on will point to another file in the bundle of certs provided by the certificate authority.

How to prepare the files

To prepare the certs for the script in this zip file, follow the instructions above. As you walk up the chain, rename each file, giving it a prefix. For example, in this folder, the first file is "www_sunshinesports_com.crt." Rename that to "01_www_sunshinesports_com.crt."  Do this for each cert in the chain. Click here to read more about how certs should be ordered.

Once this is done, create a combine.sh to combine these files into a single file. Here's an example:

#!/bin/bash
cat 01* 02* 03* 04* > domain.com.combined_with_intermediate_certs.crt

Read combine.sh for more details. If you have more than four files, be sure to add them into the script. Also, be sure to properly rename the file. For example, if you had five files and a fictional domain of domain.com, you'd edit combine.sh in the following way:

# notice the extra file, 05
cat 01* 02* 03* 04* 05* > domain.com.combined_with_intermediate_certs.crt

Custom Domain

Back in Salesforce, navigate back to Setup > Domains > Add Domain. Now you're actually going to create the Custom Domain record, making sure to link the certificate that was added previously to the domain.

Navigate to Setup > Custom URLs > New Custom URL and create the link between the Domain and the Experience Site it should point to.

Go back to Setup > Domains and click Activate next to your new Domain. The "www.sunshinesports.com" URL now redirects to your Experience Site.

Setting up a custom URL is important for your brand, and it's important that this be done correctly. If you want help with this process, or with any of your other Salesforce needs, drop us a line using the Contact form at the bottom of this page! We're always eager to help our customers get the most out of their Salesforce investment.

References

https://help.salesforce.com/articleView?id=000336819&type=1&mode=1

https://help.salesforce.com/articleView?id=sf.domain_mgmt_overview.htm&type=5

Explore another topic:

Contact Us

Thank you! Your submission has been received!

Oops! Something went wrong while submitting the form