13

I am researching if I can host multiple domains on one server through HTTPS but for each domain, I have a different certificate.

In this case, I would need to know the domain of the incoming connection so in that first part of the SSL handshake, will it have the information I need to send back the correct certificate for that domain?

Mast
  • 445
  • 6
  • 15
Dean Hiller
  • 233
  • 2
  • 7

3 Answers3

26

Yes, as long as the server and the clients support the Server-Name-Indication (or SNI) extension. This extension allows for virtual hosting for HTTPS, where you have multiple independent domains and certifications bound to a single IP address.

Most clients these days do support SNI. The place where you might have issues is if you have older clients using platforms like Windows XP, old versions of Android, or Java 6.

Xander
  • 35,796
  • 27
  • 116
  • 144
9

Without SNI, the domain first appears in cleartext in the Server Hello of the TLS handshake (In the rdnSequence of the Certificate field).

With SNI, the domain first appears in cleartext in the Client Hello of the TLS handshake (In the SNI field).

Source: I fired up apache2 with TLS and took packet captures before and after implementing SNI (Virtual Hosts in apache2).

cremefraiche
  • 2,163
  • 14
  • 24
  • 3
    Only the second case can be used for what is being asked for in the question - allow the server to select right domain and certificate at the beginning of the SSL/TLS handshake. --- The first case can be used for example by security devices (like firewalls, IPS, URL filtering, application detection etc.) to be able to distinguish domain names without SSL/TLS decryption. – pabouk - Ukraine stay strong Feb 10 '16 at 09:45
8

Aside from SNI, there is an option to get a multi-domain certificate. Several certificate providers offer such certificates (not endorsing anyone, Google is your friend).

With a multi-domain certificate, you don't need to know the domain name at the beginning of the handshake, as the certificate is effectively valid for all the domain names listed.

Here's how an example of how such certificate looks like:

enter image description here

Dmitry Grigoryev
  • 10,152
  • 1
  • 27
  • 56