I'm trying to use the module request in my node.js app, and I need to configure proxy settings with authentication.
My settings are something like this:
proxy:{ host:"proxy.foo.com", port:8080, user:"proxyuser", password:"123" }
How can i set my proxy configuration when i make a request? Could someone give me an example? thanks
The HTTP Proxy-Authenticate response header defines the authentication method that should be used to gain access to a resource behind a proxy server. It authenticates the request to the proxy server, allowing it to transmit the request further.
Here is an example of how to configure (https://github.com/mikeal/request/issues/894):
//...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", function (err, resp, body) { ... })
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With