When trying to post request directly from angular, got the CORS error:
Access to XMLHttpRequest at '***' from origin 'http://localhost:4200' 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.
The browser adds a OPTION call (preflight) as the content-type is application/json
Can add a chrome shortcut like the below to make the request successful:
"C:\Program Files\Google\Chrome\Application\chrome.exe" --disable-web-security --user-data-dir="c:/chrome_dev"
No comments:
Post a Comment