I have a Raspberry pi 3. and installed web server. I have a file http1.py that listens to port 432 and with variable "a" that passes from URL, it will turn lights on and off through GPIO: "http://192.168.0.5:432/turn?a=1" I also opened the ip forwarding on my router under port 80 and it works. On my raspberry pi server I have index.html file that uses Ajax to access the http://192.168.0.5:432/turn?a=1:
function ras(str) {
var url = "HTTP://192.168.0.17:432/turn?a="+str;
xmlHttp = GetXmlHttpObject(stateChanged);
xmlHttp.open("GET", url, true);
xmlHttp.send(null); .....
}
function stateChanged() {
if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
Blah, blah ...
now, with-in the network, it works fine (turn GPIO on and off) but with external ipaddress 75.129.-.-:80, I see the index.html BUT when I access the link which activate the Ajax, nothing happens.
What am I doing wrong? Or, is there any better way to access the GPIO from out of my network?