cancel
Showing results for 
Search instead for 
Did you mean: 

CORS Issue when Calling CAP Service from HTML5 Application (Non-UI5)

subhm779
Explorer
0 Kudos
185

I have an HTML5 application built purely with HTML, JavaScript, and CSS (not on SAP UI5), and I need to call a CAP (Cloud Application Programming) service on SAP BTP. When I try to make the request from the front-end, I'm encountering a CORS (Cross-Origin Resource Sharing) issue.

What are the steps to resolve this CORS issue, and how can I configure my CAP service or AppRouter to allow cross-origin requests from my HTML5 app?

Thanks in advance.

#

View Entire Topic
gregorw
Active Contributor

Beside the solution from Wouter I think you should check out the examples at multi-cloud-html5-apps-samples. Either use the custom or managed approuter. Using xs-app.json you configure a proxy to the CAP backend and that way you can avoid CORS issues. Also the Approuter allows you to add authentication.