title: Node.js HTTPS proxy server not working
body: <p>I would like to create a proxy for <code>HTTPS</code> connections with Node.js. I am using the <a href="https://github.com/nodejitsu/node-http-proxy" rel="nofollow"><code>http-proxy</code></a> library, which works well. I can get a <code>HTTP</code> proxy to work perfectly, but when I try <code>HTTPS</code>, the request to the proxy just times out. Here is my code (a slightly modified version of the <code>node-http-proxy</code> <a href="https://github.com/nodejitsu/node-http-proxy/blob/master/examples/http/proxy-https-to-https.js" rel="nofollow"><code>proxy-https-to-https</code></a> example):</p>
  
  <pre><code>var http = require("http"),
      https = require("https"),
      httpProxy = require("http-proxy"),
      fs = require('fs');
  
  var httpsConfig = {
    key: fs.readFileSync('./jackos2500-key.pem'),
    cert: fs.readFileSync('./jackos2500-cert.crt'),
  };
  
  https.createServer(httpsConfig, function (req, res) {
    res.writeHead(200, { 'Content-Type': 'text/plain' });
    res.write('hello https\n');
      res.end();
  }).listen(8000);
  
  httpProxy.createServer(8000, 'localhost', {
    https: httpsConfig,
    target: {
      https: true,
      rejectUnauthorized: false
    }
  }).listen(443);
  </code></pre>
  
  <p>Is there something obvious I'm missing here or is there some other issue?</p>