i’m running locally an openhab docker container (it runs on http://localhost:8080), and i used cloud connector to connect the local openHAB runtime to a remote openhab cloud (myopenhab), to be able call API from outside.
I’have a simply angular frontend (which runs locally on http://localhost:4200) that i use to call REST API on myopenhab, but everytime i get CORS problem with the following error:
No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
It seems like myopenhab does not allow CORS.
Is there a way to allow CORS on cloud ?
Not without changing the code running the cloud server. You’ll have to open an issue to see if they will allow that (or you can fork, update, and deploy your own cloud server instance).
However, given both the front end and openHAB are running locally, why depend on a third party cloud service (myopenhab.org) to facilitate communication between the two? If you are concerned about only allowing access to your end users through myopenhab.org, set up your Docker networking so your angular front end can see the openHAB Docker container and prevent access to openHAB from outside that Docker network.
Thank you for your time.
The local installation was for the purpose of trying to enable CORS only. My need was to be able to use the APIs of a local installation from the outside, that’s why I used a remote openhab cloud like myopenhab.