Mapping an endpoint to a cross-origin resource sharing (CORS) policy
The purpose of a CORS policy is to enable cross-domain requests. In Pega Platform, CORS policies can only be associated with REST services. When setting up cross-origin resource sharing (CORS) policies, you must map to a REST endpoint to specify which CORS policies apply to it. By doing so, you define which domains are allowed to access these resources within your Pega application.
In the header of Dev Studio, click.
On the Endpoint-CORS policy mapping form, click Add endpoint.
In the Endpoint-CORS policy mapping dialog box, in the Endpoint field, specify a valid endpoint (path or URL).
Click Add policy.
In the CORS Policies field, specify one or more CORS policies that map to this endpoint.
The sequence in which you list the CORS policies is significant. At run time, the system checks the CORS policy rules in the order that they are listed on the CORS-Endpoint Security form, until a match is found. Matching is based on the request method and the origin header value, which the system compares to the allowed request methods and allowed origins.
- A request from the origin that is specified in the CORS policy is recognized as secure for this REST endpoint. Requests that satisfy the policy are sent responses with the appropriate headers, as defined in the CORS policy.
- A request from an origin that is not specified in the CORS policy is not considered secure, and the browser returns an error message stating that the cross-origin request was denied.