Cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Call backend api hosted on MindSphere from UI app hosted on MindSphare - CORS Issues

Legend
Legend
Depending on the use case, you might be able to deploy both your backend apps (or frontend + backend, ...) as part of the same logical mindsphere application, but backed by several cloudfoundry applications in the background (multiple buildpacks). That way you won't have issues with CORS, since both will be served under the same domain, but under different subpaths.

In the devops-demo project we do exactly this with a frontend angular served by the staticfile buildpack and the backend served by the nodejs webpack, all part of the same mindsphere application.

Re: Call backend api hosted on MindSphere from UI app hosted on MindSphare - CORS Issues

Hi @MichaelE... any news on this?

Re: Call backend api hosted on MindSphere from UI app hosted on MindSphare - CORS Issues

Experimenter
Experimenter

Hi @FedericoPeccia 

I was just working on this problem a bit ago an here's what ended up working for me:

 

I have 2 Apps in Mindsphere, from here on called UI and Server.

 

Configuration of UI in Mindsphere:

UI: static build pack / Angular

    - Component1:
     https://<cf-name-1>.apps.<region>.mindsphere.io
    - Endpoints1:
          /*
          /assets/*
....
     - Component2:
          https://<cf-name-2>.apps.eu1.mindsphere.io
     - Endpoints2:
          /app2/*
          /app2/<other-routes>/*

 

 

Server: nodejs buildpack
     - component1:
          https://<cf-name-2>.apps.<region>.mindsphere.io
     - Endpoints1:
          /**


The App2 exposes a route on the server side:
          /app2/*

 

 

On the front-end side, the UI app can make requests to the following routes and it will work:
          https://<tenant-name>-<app1-name>-<provider-name>.<region>.mindsphere.io/app2
       --- OR ----

          /app2

 

In other words, all requests from the UI app are actually going through the UI App itself. Mindsphere then handles the requests to the different endpoints. I hope this helps you. If you have any questions feel free to ask. 

Re: Call backend api hosted on MindSphere from UI app hosted on MindSphare - CORS Issues

Creator
Creator

Hi,

Is this functionality implemented? Do have a similar requirement where we have to call custom API crossing domain?

 

Thanks,

Divya Garg 

Re: Call backend api hosted on MindSphere from UI app hosted on MindSphare - CORS Issues

Creator
Creator

Hi,

Is this functionality implemented? We have a similar requirement where we have to call custom API crossing domain?

 

Thanks,

Divya Garg 

Re: Call backend api hosted on MindSphere from UI app hosted on MindSphare - CORS Issues

Creator
Creator
Hi,
Is this functionality implemented? Do we have a similar requirement where we have to call custom API crossing domain?
Thanks,
Divya Garg

Re: Call backend api hosted on MindSphere from UI app hosted on MindSphare - CORS Issues

Creator
Creator
Hi,
Is this functionality implemented? Do we have a similar requirement where we have to call custom API crossing domain?
Thanks,
Divya Garg

Re: Call backend api hosted on MindSphere from UI app hosted on MindSphare - CORS Issues

Creator
Creator
Hi
Is this functionality implemented? Do we have a similar requirement where we have to call custom API crossing domain?
Thanks,
Divya Garg

Re: Call backend api hosted on MindSphere from UI app hosted on MindSphare - CORS Issues

Creator
Creator

Hi,
Is this functionality implemented? Do we have a similar requirement where we have to call custom API crossing domain?
Thanks,
Divya Garg