lundi 7 décembre 2020

Any way to whitelist my Angular frontend app under webrelay-10?

I'm developing an app(using Angular9) that will be able to control switches located under the webrelay-10 application. I am able to control the relay switches but keep getting an error saying "No Access-Control-Allow-Origin". I've looked at some other stack overflow posts that suggest using stateFull.xml instead of state.xml in the endpoint in order to avoid the error but this did not work. I understand that normally I would have to add my frontend under this cors header in order to whitelist in the backend but it doesn't seem like there is any way to do this with the webrelay?

Here is how I am currently sending a get request to turn on a relay switch in the webrelay:

this.http.get("http://xxx.xx.xxx.xx/stateFull.xml?relay2State=1 HTTP/1.1\r\n\r\n', { responseType: 'text' }).subscribe(
  response => console.log(response),
  err => console.log(err)
);

Any help would be great.

Aucun commentaire:

Enregistrer un commentaire