schufti wrote:don't know for lua but in general if it is a smart proxy, one connects the http client to the proxy and puts the real-world url into the header of the http request...
That's true if you restrict yourself to using the NodeMCU net module you can of course establish a connection via proxy yourself.
conn = net.createConnection(net.TCP, 0)
conn:on("receive", function(sck, payload) print(payload) end)
conn:on("connection", function(sck)
print("connection to proxy established")
sck:send("GET /get HTTP/1.1\r\nHost: httpbin.org\r\n\r\n")
end)
conn:connect(80, "111.13.136.46")
This connects to the proxy 111.13.136.46 rather than to the real target. Then it sends an HTTP GET request for http://httpbin.org/get to the proxy (which it then forwards). The proxy is a random public server I picked from http://proxylist.hidemyass.com/.
Output:
> connection to proxy established
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 16 Aug 2016 21:23:43 GMT
Content-Type: application/json
Content-Length: 130
Connection: keep-alive
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
{
"args": {},
"headers": {
"Host": "httpbin.org"
},
"origin": "111.13.136.46",
"url": "http://httpbin.org/get"
}
"origin": "111.13.136.46" indicates that the request httpbin.org receives is indeed from the proxy rather than from our client.