lilzz
Posts: 411
Joined: Sat Nov 30, 2013 5:27 pm

Trying to make a Proxy for Pi

Sun Nov 23, 2014 6:05 pm

Code: Select all

def rPiHTTPproxy(httpVerb,protocol,host,path,data,headers):
       if httpVerb == "GET":
      req = urllib.request.Request(url)

 try:
    response = responseBytes.decode('utf-8')
    return response
My question is Javascript should knows the IP address of Pi1 and Pi 2. And if it sends the request to Pi 1 but with host equals to IP address of Pi 2, then the Proxy will check out and forward to Pi2. If the request with host =Pi 1 IP address then it won't forward the request.

So, the proxy is really simple, few lines that includes checking IP address of whether its for Pi 1or Pi2 and then decides to forward it or not?
Attachments
proxy.png
proxy.png (25.72 KiB) Viewed 236 times

Return to “General discussion”