function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Eyal Cohen 7Eyal Cohen 7 

HTTPS request from LWC

Hi,

I am new to the enviornment.

I am trying to send https get request to a server from LWC but it doesn't work. I have added the remote server domaion to CORS & CSP trusted sites but nothing help.

WIll appericiate nay help here.

Access to XMLHttpRequest at 'http://.......' from origin 'https://ruby-enterprise-9373-dev-ed.lightning.force.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
DevADSDevADS
Hi Eyal,

Try to make API callouts from apex classes and return the response to the component. Hope this helps.

Post here if you've any further questions.

Happy Coding!!