How can I force a meteor app to make all HTTP call

2019-03-29 08:40发布

I'm trying to emulate curl through a proxy server. The meteor docs don't mention any proxy settings for HTTP.* methods.

Is there a meteor-specific solution? Right now I'm using ProxyChains.

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.

标签: proxy meteor
2条回答
霸刀☆藐视天下
2楼-- · 2019-03-29 09:09

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).

You no longer need to use the http-more package.

Old answer, pre-Meteor 1.1

One method would be pass a proxy parameter to HTTP.* calls, which use the request module, which supports proxies as an option.

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.

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.

查看更多
看我几分像从前
3楼-- · 2019-03-29 09:15

Here's a Meteor proxy package: https://npmjs.org/package/seafish-http-proxy-meteor

It's not available through atmosphere, but it is an npm package designed for meteor, which means it will be very easy to integrate.

查看更多
登录 后发表回答