使用网络接口(interface)的 node.js HTTP 请求

标签 node.js request

我有多个具有不同 IP 地址的网络接口(interface)。如何使用 node.js 模块 request ( https://github.com/mikeal/request ) 通过这些 IP 向站点发出 http 请求?

最佳答案

在 nodejs http 模块中,有一个 localAddress 选项可以与 http.request() 一起使用.

localAddress: Local interface to bind for network connections.

我没有使用过你提到的模块,但如果它只是将选项传递给 http 模块,我看不出它不工作的原因。

关于使用网络接口(interface)的 node.js HTTP 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15773672/

相关文章:

node.js - 每 15 秒查询一次 DB2 会导致 NodeJS 内存泄漏

node.js - Mongoose 中的聚合结果

node.js - Laradock 上的 Node+NPM

javascript - 未能执行 objective-c om.github.eirslett :frontend-maven-plugin:1. 6:install-node-and-npm(安装 Node 和 npm)

ios - 在 iOS 游戏中使用 Parse.com

python - 真的可以用 python 发布文件吗?

php - 此路由不支持 GET 方法。支持的方法 : POST. laravel-8

node.js - Node Express 未发送自定义错误消息

node.js - 如何使用nodejs elasticsearch客户端指定路由?

javascript - 使用 cheerio 解析 Node JS 上的代码