Nginx: SNI doesn’t work for server_name with multiple arguments

nginxsnissl

With this Nginx config:

server {

    listen 443 ssl;
    server_name www.x.nl x.nl;

    ssl_certificate /etc/nginx/ssl/x.nl.crtkeyca;
    ssl_certificate_key /etc/nginx/ssl/x.nl.crtkeyca;

    [...]

}

This works:

openssl s_client -servername www.x.nl -connect localhost:443 < /dev/null

This doesn't, as I get the default vhost CN:

openssl s_client -servername x.nl -connect localhost:443 < /dev/null

Am using stock Nginx from Ubuntu 12.04 LTS, unfortunately very old (1.1.19).

Is it supposed to work in newer versions or do I require to duplicate my server {} definitions?

Best Answer

I had same issue with Nginx 1.8.0.

In my case, this issue fixes setup different name in ssl_session_cache (see "???"):

ssl_session_cache shared:SSL_???:10m;