Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I force a meteor app to make all HTTP calls through a proxy?

Tags:

proxy

meteor

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.

like image 991
Dan Dascalescu Avatar asked Nov 18 '13 05:11

Dan Dascalescu


People also ask

What is HTTP proxy setting?

An HTTP proxy acts as a high-performance content filter on traffic received by an HTTP client and HTTP server. The HTTP proxy protocol routes client requests from web browsers to the internet and supports rapid data caching.


2 Answers

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.

like image 133
Dan Dascalescu Avatar answered Oct 08 '22 11:10

Dan Dascalescu


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.

like image 33
mjkaufer Avatar answered Oct 08 '22 11:10

mjkaufer