title: Nodejs - https.request Error: connect ECONNREFUSED
body: <p>I'm trying to make a http call in my node server(URL I'm trying is the skackexchange public url), below is the code</p>
  
  <pre><code>httpsServer.js
  
  var https = require('https');
  
  function httpsRequest() {
      var options = {
          hostname: 'api.stackexchange.com',
          path: '/2.2/answers',
          method: 'GET'
      };
  
      var req = https.request(options, (res) =&gt; {
          res.on('data', function (data) {
              console.dir(data);
          });
          req.end();
      });
  
      req.on('error', function (e) {
          console.error(e);
      });
  }
  
  httpsRequest();
  </code></pre>
  
  <p>And and i did <code>node httpsServer</code> in my console</p>
  
  <p>But I am getting the below error.</p>
  
  <pre><code>Error:
  
  { Error: connect ECONNREFUSED xxx.xxx.xxx.xx:443
      at Object.exports._errnoException (util.js:1050:11)
      at exports._exceptionWithHostPort (util.js:1073:20)
      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1093:14)
    code: 'ECONNREFUSED',
    errno: 'ECONNREFUSED',
    syscall: 'connect',
    address: 'xxx.xxx.xxx.xx',
    port: 443 }
  </code></pre>
  
  <p>NOTE: I'm behind a proxy server.</p>
  
  <p>What am i doing wrong? If its because I'm behind proxy is there a way to make it work?</p>