Skip to Content
Author's profile photo ROBERTO URBAN

FIORI Launchpad in SAP HCP – news tiles and cross origin policy error

Dear reader,

I would to share my experience related to the use of FIORI Launchpad (FLP) on SAP HANA Cloud Platform.

The requirement was to publish a launchpad site in order to present to the users some application tiles and some news tiles. So I customized the FLP in order to create a news tile which point to rss feed http://www.ft.com/rss/companies (Financial Times Companies news).

As soon as the configuration was completed, I refreshed my launchpad a no news was shown. So I checked my bowser console and I found the error message:

Mixed Content: The page at ‘https://flpnwc-<account_id>.dispatcher.hana.ondemand.com/sap/hana/uis/clients/…ells/fiori/FioriLaunchpad.html?siteId=<siteid>’ was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint ‘http://www.ft.com/rss/companies‘. This request has been blocked; the content must be served over HTTPS.

So I googled a bit and I found a lot of info related to this issue and how to solve it, but on an ABAP environment. Among those search results I found the video Fiori News Tile Setup & Cross Domain Origin Policy – YouTube and afterwards the note 1968559 – Set up News Tile for usage in Fiori Launchpad.

The guy in the video give me the idea to implement something similar  on HCP (he implemented an ABAP class that acts as a proxy), using the JAVA nature of this platform.

So I found an example of a servlet class which acts as a proxy (I got the starting code from here) and I created a JAVA application using that class.

I change a bit the code adding the doGet method and the haeder value Access-Control-Allow-Origin = * like

res.setHeader(“Access-Control-Allow-Origin”, “*”);

I deployed it on my HCP and I set the feed’s URL of the news tile like:

https://esaasfeedreader<account_id>.hana.ondemand.com/ESaasFeedReader/HTTPProxy?url=http://www.ft.com/rss/companies

In this way the news tile gets the feed content via my java servlet proxy and shows it in FLP

17-03-2015 18-13-06.png

Attached you can find the complete code of the class I used.

Check this doc on how to start develop JAVA applications on HCP.

!!! Remember to include Apache jars, into libs folder of your application, in order to build the servlet  !!!

17-03-2015 18-25-09.png

Hope this help someone that is facing the same issue. In case you knows a different way, maybe a more standard one, on how to do that please share!!!

Cheers

Roberto Urban

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Marco Tamagnini
      Marco Tamagnini

      Thank you Roberto for this interesting solution.

      You solved may of my problems 🙂

      Author's profile photo Former Member
      Former Member

      Hi Roberto,

      I still get the Cross domain error. Would you mind helping?
       

      Author's profile photo Louis-Arnaud BOUQUIN
      Louis-Arnaud BOUQUIN

      Hello Roberto,

      Thanks for this very interesting blog.

      I may have missed something but I can't find the attached code. I tried to code it myself but without success...

      If I launch the news application, I got the message "No 'Access-Control-Allow-Origin' header is present on the requested resource". I tried to had the "res.setHeader(“Access-Control-Allow-Origin”, “*”);" but maybe at the wrong place...

      If I launch the link directly in the browser, I get : "

      Etat HTTP 404 - /rgfeedreader/HTTPProxy"

      Would you mind helping me out ?

       

      Thank you

      Author's profile photo Bernd Herold
      Bernd Herold

      Roberto, you wrote: "Attached you can find the complete code of the class I used." ... I might have overlooked it, but I can't find the attachment or link. Can you please provide the source code? Thanks!