Support a proxy mode for outbound HTTP and HTTPS traffic #102

ozten opened this Issue Jun 28, 2012 · 6 comments


None yet

4 participants


Note: I see Issue #50 and Issue #52, this is a slightly different suggested API as well as use cases why we need proxy mode support.

Please consider adding support for a HTTP proxy everywhere node-oauth uses the http or https node module.

Suggested API:
node-oauth would look for environment variables HTTP_PROXY_HOST and HTTP_PROXY_PORT as well as a HTTPS variantion and if present, respect them.


export HTTP_PROXY_HOST=localhost
export HTTP_PROXY_PORT=8442
export HTTPS_PROXY_HOST=localhost
export HTTPS_PROXY_PORT=8443
node bin/server

Use Cases:
1) Security and Performance
When we deploy services, we put them behind squid or another proxy layer. This allows us to deny outbound http requests to unknown urls. It allows us to locally cache OAuth responses (for the calls that are cachable).

2) Load Testing
We're looking at also using this setting for load testing, so we don't hit 3rd party OAuth endpoints.

Benefits of this approach over Issue #52:
1) Adding yet another parameter to the API is un-weildy
2) Many existing node libraries depend on node-oauth. Having an ENV variable to control this doesn't require code changes anywhere except here in node-oauth.

@ozten ozten added a commit to ozten/node-oauth that referenced this issue Jun 28, 2012
@ozten ozten Adding support for HTTP_PROXY and HTTPS_PROXY env variables.
Proposed fix for Issues #102.

It would be great to coordinate this mechanism with node-openid



Updated main description changing HTTP_PROXY to the individual HTTP_PROXY_HOST and HTTP_PROXY_PORT.

@ozten ozten added a commit to ozten/node-oauth that referenced this issue Jul 20, 2012
@ozten ozten Adding support for HTTP(S) proxies
Adding support for the following env variables:

Compatible with node-openid.

Proposed fix for Issues #102.

The node-openid project just landed support for this feature.

I've rebased into a single commit that is compatible with that project, so users of downstream libraries like PassportJS could use http proxies for OAuth or OpenID based services.



Why not support the more standard HTTP_PROXY and http_proxy variables?


I just want to give +1 for the integration of this pull request in the official source code. I need it in my project...
I agree with @jazzzz idea : http_proxy / https_proxy environnement var are more standard.


+1 for proxy support. HTTP_PROXY and HTTPS_PROXY env-var support would be nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment