CORS anywhere proxy (Cross-Origin Resource Sharing)

Aus MattWiki
Version vom 27. Januar 2023, 19:26 Uhr von Matt (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „This article describes steps enable a SAPUI5 app to use CORS (cross origin resource sharing). CORS happens, when a web application contacts resources from dif…“)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)

This article describes steps enable a SAPUI5 app to use CORS (cross origin resource sharing).

CORS happens, when a web application contacts resources from different servers. This will be prevented by default.

With SAP Business Application Studio (BAS) and Business Technology Platform (BTP) generally this can be circumvented by three approaches:

The last approach is demonstrated in this article.

I have implemented two sample applications with CORS implementation:

OpenUI5 Basic Local App

See: https://github.com/mattxdev/openui5-basic-local-app/

Explanations to CORS implementation: [SAPUI5_Local_Development_and_Deployment]

OpenUI5 Walkthrough

https://sdk.openui5.org/topic/3da5f4be63264db99f2e5b04c5e853db

In Step 25 of the walkthrough a remote OData service will be used: https://sdk.openui5.org/topic/44062441f3bd4c67a4f665ae362d1109

The CORS policy in Google Chrome prevents this to work.

Therefore I have tried to implement the same solution as in the OpenUI5 Basic Local App above, but I could not get it to work in SAP BAS on the SAP BTP Trial:

https://github.com/matt-wombat/openui5-walkthrough

Downloading this to a local machine is untested yet.