Skip to Content
May 25 at 03:02 PM

Access to XMLHttpRequest at OdataService URL at Portal URL has been blocked by CORS policy:

111 Views Last edit May 26 at 07:35 AM 2 rev

HI Guys,

Am developing an SAP UI5 application and deploying and running on my Portal server with url as shown below


I wanted to consume odata service from my ecc system whose URL is as below.


on executing below code am getting error

var odataserviceURL =  'https://ecchost:50300/sap/opu/sap/opu/odata/sap/Z***********_SRV/P**T*_M********R_V**********t/.';

var OdataModel = new sap.ui.model.odata.v2.ODataModel(odataserviceURL);

am getting below error , kindly let me know how to resolve this issue.

Access to XMLHttpRequest at 'https://c***********.com:50200/sap/opu/odata/sap/Z****V/P*t/$metadata' from origin 'https://de****.l*******' 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.