Skip to Content
0
Feb 11, 2019 at 09:46 AM

Deployemnt of Angular6 & NodeJS app on Cloud Foundary

118 Views Last edit Feb 11, 2019 at 11:05 AM 3 rev

Hi,

I have an Angular 6 application which is communicating to Node services. I have deployed both app (Angular & Node app) to cloud foundary. On SCP, both app are residing in a common space, but source code are inside diffrent folders. In the cockpit, i can see two diffrent apps. After deploying both the app, i ran a command i.e. "cf apps" which is giving me 2 diffrent url for both applications.

Angular: https://simple-crud-app.cfapps.eu10.hana.ondemand.com/

Node: https://simplehttpserver-zany-giraffe.cfapps.eu10.hana.ondemand.com/

When i am running angular url in browser, it is giving me CORS error because both application is running on diffrent urls.

Error: Access to XMLHttpRequest at 'https://simplehttpserver-zany-giraffe.cfapps.eu10.hana.ondemand.com/' from origin 'https://simple-crud-app.cfapps.eu10.hana.ondemand.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

For angular app, i am using "staticfile_buildpack" in the manifest.yml file and for node app i am using "nodejs_buildpack" as a build pack.

Can someone please help me to indentify the root cause of this issue and let me know how to fix it ?