Node.js Multiple SSL Certificates

Is it possible that Node.js uses multiple SSL certificates? I am currently using a single certificate, but issue a new certificate that matches other domains.

Since my server is behind a load balancer, there are two ways to get to it, and I would like to match them. Is there a way to use two certificates instead of creating one with two matches?

+6
source share
1 answer

See this answer for hosting multiple domains on the same https server

In short, you can use SNI callback from the https server.

SNI stands for Server Name Identification and is implemented by all modern browsers.

How it works:

The browser sends the host name unencrypted (if it supports SNI). The rest of the request is encrypted with a certificate. The HTTPs module then allows you to decide which SSL certificate will be used to decrypt the connection.

SNI Notes:

  • SNI is used by AWS Cloudfront and other services if a secure connection is required
  • SNI requires a modern browser to work. However, given that AWS uses this, I am also confident in its use.
  • Depending on how you implement it, this may slow down the request.
  • It is better to put a nginx proxy server in front of it.
    • Then your connection moves as follows: (HTTPS) -> NGINX -> (HTTP) -> Node
    • Nginx can also serve static files that can optimize your site.

Hope this helps you. I post this for documentation purposes.

+6
source

Source: https://habr.com/ru/post/954724/


All Articles