Adding the proxy script to Salesforce Lightning sites

To add our proxy script to Salesforce Lightning pages, it is important to ensure that the page CSP settings are updated correctly if these are applied.

1. Adding custom CSP rules to allow for our proxy

  1. Click on 'Builder' next to your selected page Salesforce Lightning Builder settings
  2. Click on settings along the left hand side > Security & Privacy
  3. Scroll down to CSP Settings and select 'Relaxed'
  4. On 'Trusted sites for scripts' create two entries. 'https://proxy.csidetm.com/script.js' and 'https://proxy.csidetm.com' Salesforce Lighting Builder settings

This will update your CSP to allow our script to run on your site. Ensure to not remove any other entries you have so that your other scripts can continue to load as normal, even when they are not being proxied.

2. Add our script URL to your site

  1. Click on 'Edit Head Markup'
  2. Paste our script URL into the head of the HTML above all other scripts.
    <!-- c/side script -->
    <script src="https://proxy.csidetm.com/script.js" referrerpolicy="origin"></script>
    <!-- the rest of your head code/scripts -->

Edit Salesforce HTML cside

With the script now added and the CSP Settings updated, you should now be able to activate your domain and monitor this page on your c/side dashboard. Ensure to add this to all the pages where it is required.

3. Activate your domain

Now that the script has been added to your page, you can add the domain to your c/side dashboard if this has not been done already and activate it. First click on domains along the left hand side of your dashboard, and add a new domain then follow the prompts.

Activate domain on c/side

On this page