I'm trying to call some Domoticz API commands from a local webpage I'm running. Domoticz is running on a different Raspberry Pi, and thus has a different IP address. This is triggering CORS, which blocks my request. I've dealt with CORS before, but this time I simply can't get anything working, since I'm very confused about where I should be allowing this request. It feels like Domoticz itself is causing the CORS error, but that would be very weird for an API.
My setup:
Domoticz is running on RPi number 1.
Origin of request webpage is running on RPi number 2, with the webpage hosted on Apache.
Code: Select all
var xhttp = new XMLHttpRequest();
var url = "http://192.168.0.254:8080/json.htm?type=command¶m=switchscene&idx=2&switchcmd=On";
xhttp.open("GET", url);
xhttp.setRequestHeader("Authorization", "Basic KEY");
xhttp.withCredentials = true;
xhttp.send();
So, is Domoticz blocking my request, or is Apache causing these CORS issues? I've tried setting the access control headers in apache, but they don't seem to do anything, which would make sense since the request is coming from that device, not going to it. Any help would be appreciated.