Newer Version Available
CspTrustedSite
Declarative Metadata File Suffix and Directory Location
CspTrustedSite components are stored in the cspTrustedSites directory of the corresponding package directory. The file name matches the unique name of the trusted site, and the extension is .cspTrustedSite.
Version
CspTrustedSite components are available in API version 39.0 and later.
Fields
| Field | Field Type | Description |
|---|---|---|
| context | CspTrustedSiteContext (enumeration of type string) | Declares the scope of trust for the listed third-party host.
This field is available in API version 44.0 and later. |
| description | string | The description explaining what this trusted site is used for. |
| endpointUrl | string | Required. The URL for the trusted site. |
| isActive | boolean | Required. Indicates if the trusted site is active (true) or not (false). |
Declarative Metadata Sample Definition
A sample XML definition of a trusted site is shown below.
1<?xml version="1.0" encoding="UTF-8"?>
2<CspTrustedSite xmlns="http://soap.sforce.com/2006/04/metadata">
3 <description>Used for Lightning component callout to mapping web service</description>
4 <endpointUrl>https://www.maptestsite.net/</endpointUrl>
5 <isActive>true</isActive> <context>LEX</context>
6</CspTrustedSite>Usage
CSP is a W3C standard that defines rules to control the source of content that can be loaded on a page. All CSP rules work at the page level, and apply to all components and libraries. By default, the framework’s headers allow content to be loaded only from secure (HTTPS) URLs and forbid XHR requests from JavaScript.
- connect-src
- frame-src
- img-src
- style-src
- font-src
- media-src