Skip to Content
Author's profile photo Christian Thanos

SAPUi5 – Fighting Same-Origin-Policy with a Proxy-Servlet and the Manifest.json

This blog is facing the Same-Origin-Issue using a proxy servlet when the model is set up by the manifest.json.


During development of an mobile Web-Application using SAPUi5 and Eclipse I faced the Same-Origin-Policy when I was trying to consume a remote OData-Webservice – lets say

After having a quick look at the SAPUI5 Documentation I found out that there is a proxy mechanism to avoid the Same-Origin-Policy for quick and local testing. It states that the exernal URI needs to be extended by an “proxy/” prefix in the coding.  However, it does not work for me since I implemented a global manifest.json and I didn’t know how to exactly extend an external http://hostname/… URI with the proxy/ prefix In the dataSources attribute of the manifest.json. Should it be like

    • proxy/http://hostname/…
    • proxy/http/hostname/…
    • http://hostname/proxy/…
  • … 

??? It seems there are to many possible combinations to me. Moreover, it is neccessary to extend the web.xml in the WEB-INF folder. Since I was struggeling around for at least two days I would like to share my solution in the following.


Example for consuming the Northwind-Service 


This Example is based on the SAP Walkthrough tutorial step 26. You can find it and download the source here:


To avoid the Same-Origin-Issue modify the following files:


Adopting the URI in the manifest.json


	"_version": "1.8.0",
	"": {
		"dataSources": {
			"invoiceRemote": {
			 "uri": "proxy/V3/Northwind/Northwind.svc/", 
				"type": "OData",
				"settings": {
					"odataVersion": "2.0"
	"sap.ui5": {
		"models": {
			"invoice": {
				"dataSource": "invoiceRemote"


It is essential that you don’t have the hostname and the procotol in your URI-String since this will be concatenated by the web.xml as we see in the following:

Activating the Servlet in the WEB-INF/web.xml


<?xml version="1.0" encoding="UTF-8"?>




The hostname and the proctol will be declared in the web.xml and thus needs not to be passed to the manifest.json. Moreover, It came out that it is essential to set the context parameter to true by adding the corresponding XML-Tags to make it work. Otherwise the Framework tries to concatenate the localhost server to the service address. Finally, it could solve my issue.


Greetings from Duesseldorf – Germany

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.