title: How to use node-http-proxy for HTTP to HTTPS routing?
body: <p>Here's the module version that I'm using:</p>
  
  <pre><code>$ npm list -g | grep proxy
  ├─┬ http-proxy@0.10.0
  </code></pre>
  
  <p>A webservice calls into my machine and my task is to proxy the request to a different url and host with an additional query parameter based on the contents of the request's body:</p>
  
  <pre><code>var http      = require('http'),
      httpProxy = require('http-proxy')
      form2json = require('form2json');
  
  httpProxy.createServer(function (req, res, proxy) {
    // my custom logic
    var fullBody = '';
    req.on('data', function(chunk) {
        // append the current chunk of data to the fullBody variable
        fullBody += chunk.toString();
    });
    req.on('end', function() {
        var jsonBody = form2json.decode(fullBody);
        var payload = JSON.parse(jsonBody.payload);
        req.url = '/my_couch_db/_design/ddoc_name/_update/my_handler?id="' + payload.id + '"';
  
        // standard proxy stuff
        proxy.proxyRequest(req, res, {
          changeOrigin: true,
          host: 'my.cloudant.com',
          port: 443,
          https: true
        });
    });
  }).listen(8080);
  </code></pre>
  
  <p>But I keep running into errors like: <code>An error has occurred: {"code":"ECONNRESET"}</code></p>
  
  <p>Anyone have an idea about what needs to be fixed here?</p>