Aurelia AdminPanel served inside Express-App - Cors Error on Droplet?

Posted October 15, 2016 2.2k views
Node.jsMEANDeploymentUbuntu 16.04

Jolly good day guys!

I’m trying to get a Project to work that contains of 1.) An Express application that Serves all FIles to the visitor, and 2.) An Aurelia Admin-Panel that allows changes to the database over api/fetch-calls to the express application.
The Aurelia-Adminpanel is serverd via the public/static files of the express-application.

On my Local Machine this combination works great, cause this way there are no cors-problems, since the Admin-App is serverd over the express-app.

On my dropled i get an error though:
“Fetch API cannot load http://localhost:3030/casino. Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ’’ is therefore not allowed access.”

Which looks like a cors problem, right? Thats the exact same error I get when I start the adminpanel-index not over my express app via routes, but execute it directly from my finder.

http://localhost:3030/admin <– Works on my localmachine
http://188.166.IPIP.73:3030/admin <– Error, See above

The Aurelia/Admin pannel is requesting “http://localhost:3030/**path**

Is there anything I’m missing out? Is there a way to get the desired behaviour?

Thanks a lot!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

I just realized, that the IP sending requests to the Express-App is always the Machines IP where the Aurelia-App is loaded from - regardless of where it is hosted. Is that correct?