We have a LWC which is being hosted on a VF page using Lightning Out - up until December 2022 it was working without issue but it seems we've run into a CORS issue since then (I assume a Spring release issue?).

I tried setting up the LWC directly as an action since I don't think we need the VF page anymore (that was implemented by a developer several years ago) and I'm running into the following error when the fetch method is called which is similar to the one we see on the VF side:

Access to fetch at 'https://sample.example.com/wp-json/xxx/v1/search?keyword=learner&limit=100&page=1' from origin 'https://sample--full3.sandbox.lightning.force.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.

We have the following set up:

In terms of the fetch callout - it's fairly basic

            method : "GET",
            headers : {
                "Content-Type": "application/json",
                "Authorization": "Basic "  + this.wP_Site_AuthorizationToken ,
        }).then(function(response) {
            return response.json();
        .then((myJson) =>{


I've read through many other questions and this blog (link) from Salesforce which was very helpful but did not solve my issue. Any help that could provided would be very appreciated.


  • It seems your third party is redirecting, causing it to fail. You'll need to check that you still have the correct endpoint.
    – sfdcfox
    Jan 26, 2023 at 21:48

1 Answer 1


I faced a similar problem while hitting a mock API. adding the below attributes in fetch Api solved my problem -

        method: "GET",
        mode: "cors"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .