Search code examples
proxysapui5same-origin-policy

SAP Fiori Client Proxy Error / caused by SOP?


I have developped an app on SCP Web IDE which is published to a test launchpad. It uses the OData Service CUAN_IMPORT_SRV. When I run the app on desktop everything is fine. I can create Interactions in yMarketing.

Since my app uses barcode functionality I need to use this app on mobile. So I added the app to a test Fiori launchpad and tried to access the launchpad via SAP Fiori Client. The hostname of the URL defined for the OData model is not public available.

Here I define the OData model:

var uname = "myuser";
var pw = "mypassword";

var oModel = new sap.ui.model.odata.v2.ODataModel("https://hostname:port/sap/opu/odata/sap/CUAN_IMPORT_SRV/", true, uname, pw)

Proxy + VPN is necessary to access the server.


1) At first I tried to open the launchpad in Fiori Client app with configured proxy and a running VPN connection. This way, I could not access the test launchpad. This is my error log (I clear the log after every step):

error log with configured proxy and a running VPN

Page can not be found.


2) The next thing I tried was turning off the proxy. I logged in to my SCP account. I can see the launchpad now but my app is not visible. This is the new log:

error log with proxy turned off


3) I delete the settings, enter the launchpad URL again, enter my SCP username and password. The app is visible now. My log for this step:

after deleting settings


4) Start the app (proxy still off)

No server with this hostname can be found

start app without proxy


5) Turn proxy on, run the app, I need to authenticate with my login for the server:

server authentication


6) When the CRUD-Operation to the server is done, the log shows this:

CRUD error log


Is this maybe a problem of cross-origin? App running on flpportal... (test launchpad) and data I'm trying to access is on other host. When I try it in browser (HAT, Cordova Facade) I just ignore the SOP by starting the browser with --disable-web-security --user-data-dir (which works fine for test scenario). However I guess ProxyServlet or Reverse Proxy would not make it better since they are also just for testing purposes. This would mean that the only way to use the app with SAP Fiori Client would be to deploy it to ABAP repo and run it from the same origin as the data beeing requested?

I really hope someone can help me with my problem. Thank you so much!


Solution

  • I could identify the problem. As already expected, it was a problem of cross-origin. Since the application was deployed to the server and added to the launchpad everything is working fine.