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
Navigate to the Salesforce Setup homepage > all sites
- Click on 'Builder' next to your selected page
- Click on settings along the left hand side > Security & Privacy
- Scroll down to CSP Settings and select 'Relaxed'
- On 'Trusted sites for scripts' create two entries. 'https://proxy.csidetm.com/script.js' and 'https://proxy.csidetm.com'
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
Navigate to the 'Advanced' settings, located slightly above the Security & Privacy settings.
- Click on 'Edit Head Markup'
- Paste our script URL into the head of the HTML above all other scripts.
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.