Ya, if you don't already have a centralized place where HTTP requests get
created, then your monkey-patching technique is probably the easiest route
to go.


On Thu, Aug 29, 2013 at 9:55 AM, José F. Romaniello
<[email protected]>wrote:

> Hi Nathan, very nice, I'm actually doing something similar already using
> koichik/node-tunnel .. but because I don't want to patch my code and also
> the dependencies we have, we figure out this overriding http[s].request
> like this:
>
> https://gist.github.com/jfromaniello/6380601
>
> Not totally happy with this, but seems to work
>
>
>
>
>
> 2013/8/29 Nathan Rajlich <[email protected]>
>
>>
>> I've had good luck so far with creating `http.Agent` subclasses that
>> transparently connect to your desired proxy. This way, it's only 1 option
>> that needs to be added to your HTTP requests. In our app all HTTP requests
>> are wrapped by another module, so that logic was already centralized so it
>> was rather easy to add for all HTTP requests.
>>
>> I've written a few modules for different proxy scenarios (I know there's
>> others out there too, and mine are still missing some crucial features,
>> like proxy authentication):
>>
>>   - HTTP endpoints: https://github.com/TooTallNate/node-http-proxy-agent
>>   - HTTPS/WebSocket endpoints:
>> https://github.com/TooTallNate/node-https-proxy-agent
>>   - SOCKS proxy (all endpoints):
>> https://github.com/TooTallNate/node-socks-proxy-agent
>>
>>  Cheers!
>>
>> On Thu, Aug 29, 2013 at 3:52 AM, José F. Romaniello <
>> [email protected]> wrote:
>>
>>> We are deploying our application to a new environment where it has to
>>> run behind an httpproxy.
>>>
>>> We already know how to use http.request behind a proxy, but refactoring
>>> all our code and dependencies to work like that is very difficult. For now
>>> we monkey patched http.request and everything seems to work but we are not
>>> entirely happy with it.
>>>
>>> I tried proxychains but couldn't make it work with node also read about
>>> connect - proxy but haven't tried yet.  Is something like this the right
>>> solution?
>>>
>>> Thanks
>>>
>>> --
>>> --
>>> Job Board: http://jobs.nodejs.org/
>>> Posting guidelines:
>>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>>> You received this message because you are subscribed to the Google
>>> Groups "nodejs" group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "nodejs" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>  --
>> --
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines:
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "nodejs" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to