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

How to configure proxy with authentication? #894

Closed
victor0402 opened this issue May 11, 2014 · 4 comments
Closed

How to configure proxy with authentication? #894

victor0402 opened this issue May 11, 2014 · 4 comments

Comments

@victor0402
Copy link

Hi, i need to configure my proxy with authentication, something like this:

proxy:{
    host:"proxy.foo.com",
    port:8080,
    user:"proxyuser",
    password:"123"
}

How can i set this proxy configuration when i make a request?
I tried but got no success, if anyone can give me an example would be a great help
thanks

@tikotzky
Copy link
Contributor

try something like
var proxiedRequest = request.defaults({proxy: "http://proxyuser:123@proxy.foo.com:8080"});

@victor0402
Copy link
Author

@tekay thank you, this worked well

@uvenkat19
Copy link

@victor0402

can u please past the content of the file where you made changes ?

and if you know, please tell me how to bypass the request to another component which is runnig on XXXX port ?

@victor0402
Copy link
Author

@uvenkat19 my code looks like:

//...some stuff to get my proxy config (credentials, host and port)
var proxyUrl = "http://" + user + ":" + password + "@" + host + ":" + port;

var proxiedRequest = request.defaults({'proxy': proxyUrl});
proxiedRequest.get('http://foo.bar')

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

No branches or pull requests

4 participants