title: Create a Reverse Proxy in NodeJS that can handle multiple secure domains
body: <p>I'm trying to create a reverse proxy in NodeJS.  But I keep running the issue that in that I can only serve one one set of cert/key pair on the same port(443), even though I want to serve multiple domains. I have done the research and keep running into teh same road block:</p>
  
  <ul>
  <li>A node script that can serve multiple domains secure domain from non-secure local source (http local accessed and served https public)</li>
  <li>Let me dynamically server SSL certificates via domain header</li>
  <li>Example: 
  <ul>
  <li>https ://www.someplace.com:443 will pull from http ://thisipaddress:8000 and use the cert and key files for www.someplace.com</li>
  <li>https ://www.anotherplace.com:443 will pull from http ://thisipaddress:8080 and use the cert and key files for www.anotherplace.com </li>
  <li>ect.</li>
  </ul></li>
  <li>I have looked at using NodeJS's <em>https.createServer(options, [requestListener])</em>
  <ul>
  <li>But this method supports just one cert/key pair per port</li>
  <li>I can't find a way to dynamically switch certs based on domain header  </li>
  <li>I can't ask my people to use custom https ports</li>
  <li>And I'll run into browse SSL certificate error if I serve the same SSL certificate for multiple domain names, even if it is secure </li>
  </ul></li>
  <li>I looked at <em>node-http-proxy</em> but as far as I can see it has the same limitations</li>
  <li>I looked into Apache mod-proxy and nginx but I would rather have something I have more direct control of</li>
  </ul>
  
  <p>If anyone can show me an example of serving multiple secure domains each with their own certificate from the same port number (443) using NodeJS and either <em>https.createServer</em> or <em>node-http-proxy</em> I would be indebted to you.</p>