Search code examples
corsodatasapui5xsodata

CORS issue using OData service


I have created an OData service using SAP's XS application. The service is working perfectly when I try to access it via browser. When I try to consume it via SAPUI5 application, it gives me CORS error.

I even enabled the cors in the .xsacess file but it still gives me access-control-allow-origin flag error.

I am making use of the trial account and my XS application contains only the OData file i.e.myOdata.xsodata file.

Could anyone please point me to what I am missing.


Solution

  • make use of "destinations" in the Hana Cloud Platform. That acts as a proxy.

    Although, as per my knowledge, currently odata services via xs application cannot be configured via destinations in trial account. Hence, you would also need to setup cloud connector and register your service in it. Then configure the destination as on-premise to your localhost running odata service.