title: How can I use an https proxy with node.js https/request Client?
body: <p>I need to send my client HTTPS requests through an intranet proxy to a server.
  I use both https and request+global-tunnel and neither solutions seem to work.<br>
  The similar code with 'http' works.  Is there other settings I missed?</p>
  
  <p>The code failed with an error: </p>
  
  <pre><code>REQUEST:
  problem with request: tunneling socket could not be established, cause=socket hang up
  
  HTTPS:
  events.js:72
          throw er; // Unhandled 'error' event
                ^
  Error: socket hang up
      at SecurePair.error (tls.js:1011:23)
      at EncryptedStream.CryptoStream._done (tls.js:703:22)
      at CleartextStream.read [as _read] (tls.js:499:24)
  </code></pre>
  
  <p>The code is the simple https test.</p>
  
  <pre><code>var http = require("https");
  
  var options = {
    host: "proxy.myplace.com",
    port: 912,
    path: "https://www.google.com",
    headers: {
      Host: "www.google.com"
    }
  };
  
  http.get(options, function(res) {
    console.log(res);
    res.pipe(process.stdout);
  });
  </code></pre>