title: Multiple SSL Certificates and HTTP/2 with Express.js
body: <p>Scenario: </p>
  
  <p>I have an express.js server which serves variations of the same static landing page based on where <code>req.headers.host</code> says the user is coming from - think sort of like A/B testing.</p>
  
  <p><code>GET tulip.flower.com</code> serves <code>pages/flower.com/tulip.html</code></p>
  
  <p><code>GET rose.flower.com</code> serves <code>pages/flower.com/rose.html</code></p>
  
  <p><em>At the same time</em>, this one IP is also responsible for:</p>
  
  <p><code>GET potato.vegetable.com</code> serving <code>pages/vegetable.com/potato.html</code></p>
  
  <p>It's important that these pages are served <strong>FAST</strong>, so they are precompiled and optimized <a href="https://varvy.com/pagespeed/wicked-fast.html" rel="noreferrer">in all sorts of ways</a>.</p>
  
  <p>The server now needs to:</p>
  
  <ol>
  <li>Provide <em>separate</em> certificates for <code>*.vegetables.com</code>, <code>*.fruits.com</code>, <code>*.rocks.net</code></li>
  <li>Optionally provide no certificate for <code>*.flowers.com</code></li>
  <li>Offer HTTP2</li>
  </ol>
  
  <p>The problem is that HTTP2 mandates a certificate, and there's now multiple certificates in play.</p>
  
  <p>It appears that <a href="https://stackoverflow.com/questions/12219639/is-it-possible-to-dynamically-return-an-ssl-certificate-in-nodejs">it's possible</a> to use multiple certificates on one Node.js (and presumably by extension Express.js) server, but is it possible to combine it with a module like <a href="https://github.com/spdy-http2/node-spdy" rel="noreferrer">spdy</a>, and if so, how?</p>
  
  <p>Instead of hacking node, would it be smarter to pawn the task of sorting out http2 and SSL to nginx? Should the caching network like Imperva or Akamai handle this?</p>