带有代理的 node.js http 代理

标签 node.js node-modules

var HttpsProxyAgent = require('https-proxy-agent');
this.agent = new HttpsProxyAgent("http://example.proxy.com");

但是我还需要添加一组 node.js 原始代理设置。

http.Agent({ keepAlive: true });

我没有看到 httpsproxyagent 的选项来设置它,因为 https-proxy-agent 派生自 agent-base。有没有办法使用不同的 node.js 模块来实现这一点?

最佳答案

我使用了 hpagent模块。 默认情况下它有 keepAlive: true

https-proxy-agenta PR添加此功能虽然

关于带有代理的 node.js http 代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43913977/

相关文章:

node.js - 如何在 Node.js 中提取完整的 URL,而不使用 HTTP?

node.js - 使用带有 Express 的 node-formidable 上传文件时处理多个文件

javascript - 用于计算返回文档中唯一 ID 的 Mongo 聚合速度很慢

javascript - Joi 验证 - 如何根据输入使字段可选

javascript - Node.js 使用sendgrid发送模板

angular - 将 Node 模块导入 Angular 2

javascript - 在 native Node 模块中,如何确保我的异步代码始终在同一线程上运行?

mysql - .hasMany 调用的内容不是 Sequelize.Model 的子类

node.js - npm runject 后无法使用 JSX

javascript - 如何从 Node 包库内部需要根项目目录中的内容?