简体   繁体   中英

C++ SSL Virtualhosting

While implementing a C++ Server I came around the problem of having two domains pointing to the same server. Implementing a standard SSL Server using boost is not really a problem, but I now need to somehow decide which certificate to use when connected. I know it is possible because it is common practice in Mass Webhosting.

For example a single Apache/nginx is capable of providing two different https websites using two different certificates on the same port (443). I'd like to implement a similar behaviour in C++.

How does apache handle this ?

Is it possible to implement this using boost asio or do I need to use some lower level API (OpenSSL/OS) ?

The way to tell the server in advance which host is desired is to use Server Name Indication, as described in RFC 6066 . It adds an extension field server_name to TLS including a server name list which the server can then use.

This is not a required field, so not all browsers or servers support it. But the support in mainstream products is good at the moment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM