4

I want to make an https request call from node.js, using the standar https Client. But I cannot reach the remote server directly from my network and need to go through a proxy.

How do I tell node.js to use the proxy? I tried option as following the post

{ path : 'https://api.xxx.com:8081/token';
host : 'proxy-us.xxxx.com';
port : 8082;
method : POST_METHOD;
headers : {
    'host':  "api.xxx.com:8081"
}

But never reached

1
  • Is it an HTTP or SOCKS proxy? Commented May 31, 2013 at 19:53

1 Answer 1

3

I am a big fan of Mikeal's request module. It makes http requests very easy and has many features such as proxy support, streaming, forms, auth and oauth signing. Here is a proxy example:

var request = require('request');
request({'url':'https://api.xxx.com:8081/token',
         'proxy':'http://proxy-us.xxxx.com:8082'}, function (error, response, body) {
  if (!error && response.statusCode == 200) {
    console.log(body) // Print the google web page.
  }
})
Sign up to request clarification or add additional context in comments.

1 Comment

It is great for http, but I need https requeqes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.