简体   繁体   中英

Proxy does not work in nodejs request module

var request = require('request');
    var proxyUrl = "http://" + 'EvjhdznB' + ":" + 'ouQEtyk7' + "@" + '5.188.222.111' + ":" + '8080';

var proxiedRequest = request.defaults({
      'proxy': proxyUrl
    });

    proxiedRequest.get("http://whoer.net", function (err, resp, body) {
      console.log(err)
      //console.log(resp)
    console.log(body)
    })

This proxy 'proxyUrl' work when connect to google.com but does not work for some other sites, for example whoer.net. it gives me this error

`502 Bad Gateway</h2><h3>Host Not Found or connection failed<`

also i have socks port 11319 for this proxy, and module request in nodejs gives another error

{ Error: Parse Error
    at Socket.socketOnData (_http_client.js:440:20)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at TCP.onread (net.js:594:20) bytesParsed:

好的,我发现存在两种协议ipv6和ipv4,并且我的代理可以在ipv6上运行,没有多少网站支持新协议,并且它们仅在ipv4上运行

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM