如何强制流星应用程序通过代理进行所有 HTTP 调用? [英] How can I force a meteor app to make all HTTP calls through a proxy?
问题描述
我正在尝试通过代理服务器模拟 curl.meteor docs 没有提到 HTTP.* 方法的任何代理设置.
I'm trying to emulate curl through a proxy server. The meteor docs don't mention any proxy settings for HTTP.* methods.
有专门针对流星的解决方案吗?现在我正在使用 ProxyChains.
Is there a meteor-specific solution? Right now I'm using ProxyChains.
理想情况下,我会使用 SOCKS 代理,并且只有 HTTP.* 调用会通过它,但我对通过任何类型代理的应用程序的所有调用都持开放态度.
Ideally I'd use a SOCKS proxy and only HTTP.* calls would go through it, but I'm open to all calls from the application going through any type of proxy.
推荐答案
Meteor 1.1 更新
您可以通过 npmRequestOptions 将选项直接传递给 npm 请求模块HTTP.* 的代码> 参数.该功能由此提交启用,我在 2013 年提交了一个问题(见下文).
Meteor 1.1 update
You can pass options directly to the npm request module via the npmRequestOptions
parameter to HTTP.*. The functionality was enabled by this commit made after I filed an issue in 2013 (see below).
您不再需要使用 http-more 包.
You no longer need to use the http-more package.
一种方法是将 proxy
参数传递给 HTTP.*
调用,该调用使用 请求模块,支持代理作为选项.
One method would be pass a proxy
parameter to HTTP.*
calls, which use the request module, which supports proxies as an option.
proxy
不是 HTTP 包中公认的选项,并且 我已经提交了一个请求,只是通过无法识别的选项.它被 Meteor 核心开发人员之一拒绝.
proxy
isn't a recognized option in the HTTP package, and I've filed a request to simply pass through unrecognized options. It was rejected by one of the Meteor core developers.
我宁愿人们在这个问题上投票,要求通过未知选项而不是被忽略.同时,我创建了一个可以传递选项的包:http-more.
I'd rather people vote on that issue, asking for unknown options to be passed through instead of being ignored. In the meantime, I've created a package that does pass through options: http-more.
这篇关于如何强制流星应用程序通过代理进行所有 HTTP 调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!