【问题标题】:node.js Https request through proxy failnode.js 通过代理的 Https 请求失败
【发布时间】:2017-04-25 23:31:56
【问题描述】:

我正在尝试使用代理发出 https 请求。

            var agent = new HttpsProxyAgent(proxy_url);
            let options = {headers:headers, url:urlBase + item, agent}

           request(options, (error, response, html)=>{
                if(error){
                    console.log('error: ', error);
                    return reject('error');
                }
                let $ = cheerio.load(html);
                amazonProductParser.parse($);
            });

我遇到了不同的错误(400、403、407)。我尝试连接的网站是 amazon.com,以防万一。

【问题讨论】:

    标签: node.js proxy request


    【解决方案1】:

    我使用了request,这使得它在 Node.js 中很容易做到。

    【讨论】:

    • 我正在使用请求模块并尝试将代理添加到选项而不是代理中,例如:let options = {headers:headers, url:urlBase + item, proxy} 但不是要么工作
    猜你喜欢
    • 1970-01-01
    • 2014-02-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-16
    • 2015-10-16
    • 1970-01-01
    相关资源
    最近更新 更多