Skip to main content
100%

Gist 4985631

✓ Published0🌍 Public
Aalessioalex
Last edited Oct 10, 2012
Created on Feb 19, 2013

This example demonstrates how to configure a Node.js HTTPS server with Server Name Indication (SNI) to serve multiple SSL certificates for different hostnames. It shows the setup for routing requests to distinct backend ports using the http-proxy library, with an SNICallback that selects the appropriate certificate context based on the incoming hostname. The code uses Node.js core `crypto.createCredentials` and `fs.readFileSync`, along with a custom `getCABundle` function that parses a bundled certificate file into an array by splitting on the `-END CERTIFICATE-` marker. It explicitly maps example-a.com and example-b.com to localhost ports 10000 and 10001.

AI-generated description

Similar vizzes