cancel
Showing results for 
Search instead for 
Did you mean: 

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

govardan_raj
Contributor
0 Kudos

HI Guys,

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

https://portahost:50000/irj/portal

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

https://ecchost:50300/sap/opu/sap/opu/odata/sap/Z***********_SRV/P**T*_M********R_V**********t/.

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*******o.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.

Regards

Govardan

Accepted Solutions (0)

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos

normally if your app is hosted in hostA, it can only access the service on hostA,

in your case, you need web dispatcher to route the ecc service to abap server