Published on InterSystems Developer Community (https://community.intersystems.com)

Home > Access to XMLHttpRequest at 'http://localhost:52773/IrisVSCode/app/test' from origin 'null' has been blocked by CORS policy

Question
Amit Prajapati · Aug 23, 2019

Access to XMLHttpRequest at 'http://localhost:52773/IrisVSCode/app/test' from origin 'null' has been blocked by CORS policy

Hi All,

I have created a REST class in which have the Parameter HandleCorsRequest = 1;

I can able to access the API using Postman, but not with my web application. It throws the below error.

Access to XMLHttpRequest at 'http://localhost:52773/IrisVSCode/app/test' from origin 'null' 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.

Please note that I have tried all option which are mentioned on following URL:

https://cedocs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?K...

I have also provided all rights to my _system user, which I am using while calling the webAPI.

I am provided the screenshots of my IRIS code, jQuery code (to call webAPI) and IRIS setting.

Code Of TestAPI.cls file:

jQuery Code to all the API:

Error Which I am facing while calling the API:

Working fine for POSTMAN:

 

Web application setting:

 

Please let me know if you need some more information from me regarding this.

Thanks,

Amit Prajapati

#Angular2 #JavaScript #SOAP #InterSystems IRIS

Source URL:https://community.intersystems.com/post/access-xmlhttprequest-httplocalhost52773irisvscodeapptest-origin-null-has-been-blocked-cors