HTTP_PROXY-like variable in nodejs?

1,937 views
Skip to first unread message

Giovanni Giorgi

unread,
Oct 12, 2011, 3:42:05 AM10/12/11
to Nodejs

Hi all,
 I am building an intranet app for nodejs.

My app will unable to connect to the Internet directly. I need it because of everyauth.

On python, I can configure http proxy easily: sometimes I only need to define a shell environament variable...

export HTTP_PROXY=http://myproxy:8080/ 

Can I do something like that in nodejs? 

Thank you!

---
Gio's Blog http://gioorgi.com

mscdex

unread,
Oct 12, 2011, 3:49:12 AM10/12/11
to nodejs
On Oct 12, 3:42 am, Giovanni Giorgi <j...@gioorgi.com> wrote:
> Can I do something like that in
> nodejs?  

Not in node core, but you might try this module: https://github.com/nodejitsu/node-http-proxy

Isaac Schlueter

unread,
Oct 16, 2011, 3:20:09 PM10/16/11
to nod...@googlegroups.com
You can also provide a "proxy" argument to Mikeal's request library.

request.get({ url: "http://google.com", proxy: process.env.HTTP_PROXY })

> --
> 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 nod...@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>

Jeroen Janssen

unread,
Oct 17, 2011, 1:31:26 AM10/17/11
to nodejs
that is the 'other' side of the proxy (an actual proxy).

http_proxy/https_proxy/ftp_proxy environment variables are typically
used to control a client library to connect through a (corporate)
firewall to connect to servers on the internet.

python has http://docs.python.org/library/urllib.html#urllib.urlopen :
"The urlopen() function works transparently with proxies which do not
require authentication. In a Unix or Windows environment, set the
http_proxy, or ftp_proxy environment variables to a URL that
identifies the proxy server before starting the Python interpreter."

so I guess Mikeal's request 'proxy' option is closest to that
Reply all
Reply to author
Forward
0 new messages