Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

CORS Issue while consuming Hana's OData

$
0
0

Hi,

 

While trying to consume data from a OData JSON URL from Hana in our local application, we encounter an error as below,

 

XMLHttpRequest cannot load http//someurl&$format=json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:XXXX' is therefore not allowed access.

 

Since this is clearly a Cross Origin issue, we tried adding CORS parameters as below in .xsaccess file (as in Hana Developer Guide) to allow Cross Origin requests, but we are still shown as same error as above.

 

"cors" : // Permit cross-origin browser requests [ { "enabled" : true } ]

 

After going through few posts/blogs, we understood below parameter needs to be enabled in the Response Header of Odata URL,

 

"Access-Control-Allow-Origin" = "*";


But we are unsure on which file/place we will need to add this parameter.

 

Please help us in understanding the below queries,

 

  1. Do we need to add "Access-Control-Allow-Origin" = "*" to request header even of we enable CORS in ".xsaccess" file?
  2. If yes, in which file/place we need to add this package (since we're very much a DB resource we aren't sure on where to add in the Odata hana package) 

 

Thanks in advance!

 

Regards,

Ram


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>