April 26, 2020
Estimated Post Reading Time ~

AEM - Salesforce lightning component - Access-Control-Allow-Origin

When I try to access salesforce lightning components in AEM, I was not able to access the lightning script from AEM server, I got below error in browser console.

Issue: XMLHttpRequest cannot load https://AAAAAA.lightning.force.com/lightning/lightning.out.js.
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://localhost:5544' is therefore not allowed access.

Solution:
We need to whitelist the origin i.e. our aem server in salesforce.

Go to salesforce.com site, click on Setup -> search for CORS
Goto CORS console, give the AEM server url pattern, in my case it is https://localhost:5544




By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.