Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support proxying behind corporate proxies #337

Closed
wants to merge 1 commit into from

Conversation

akshayeshenoi
Copy link

@akshayeshenoi akshayeshenoi commented May 22, 2018

The lack of this feature is making it impossible to carry out development behind a corporate proxy. Prior to version 1.0.0, the solution to this problem was assigning the http-proxy-agent object to req.agent (#56 ).

This is not allowed in 1.0.0.

This line seems to provision a custom module, but there's no way I can configure that option.
Are you missing a line here?

@monkpow

allow proxying behind corporate proxies using http-proxy-agent
@akshayeshenoi
Copy link
Author

Looks like you could always pass an http-proxy-agent object to reqOpts.agent using the proxyReqOptDecorator option.

var HttpsProxyAgent = require('http-proxy-agent');

app.use('/proxy', proxy('http://example.com', {
  proxyReqOptDecorator: function (reqOpt, req) {
    reqOpt.agent = new HttpsProxyAgent('http://corporate-proxy.com');
    return reqOpt;
  }
}));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant