I want to make requests to an esp32 at the clients location (local-network). The Idea is to control an esp32 via the webbrowser. I want to use PHP for the backend. How can I control the esp32 without using a forwarded port.
My idea was to let a javascript-script make the http call to the local-ip from the esp32 with a simple http server on it. Localy it worked, but I wondered if this is still working if the server is outside of my local network, but I dont have a webserver, so ive uploaded a test file to github pages and tried to access my esp32 via githubpages. But unfortunately the request got blocked:
Even though the initial HTML page is loaded over a secure HTTPS connection, some resources like images, stylesheets or scripts are being accessed over an insecure HTTP connection. Usage of insecure resources is restricted to strengthen the security of your entire site. To resolve this issue, load all resources over a secure HTTPS connection.
Ive installed a basic https server on the esp32: https://techtutorialsx.com/2019/04/07/esp32-https-web-server/
but i got the same error again.The request is made in this code:
document.write("Mate");
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", "https://ip_esp32/", false);
xmlHttp.send(null);
document.write("Try:" + xmlHttp.responseText);
How can I make a request with javascript without using Node.js? If this is not possible, can I controll the local esp32 otherwise with PHP?