0
我正在嘗試在node.js的另一臺服務器上爲單個映像發出GET請求。node.js代理的困難
var http = require('http');
var site = http.createClient(80, '192.168.111.190');
var proxy_request = site.request('/image.png');
proxy_request.on('response', function (proxy_response) {
console.log('receiving response');
proxy_response.on('data', function (chunk) {
});
proxy_response.on('end', function() {
console.log('done');
});
});
即使使用此代碼,我也無法獲得「接收響應」消息以便打印出來。在節點之外,我可以做一個curl http://192.168.111.190/image.png
就好了,但是有什麼我可能會失蹤?