map $ssl_preread_server_name $sni_name {
    hostnames;
    www.vk.com      xray;
    vk.com          xray;
    www.eh.vk.com   xray;
    eh.vk.com       xray;
    tshk.duckdns.org    openconnect;
    duckdns.org           www;
    *.duckdns.org         www;
    default              vk;
}

upstream xray {
    server 11.101.0.254:6443;
}

upstream www {
    server 127.0.0.1:7443;
}

upstream vk {
    server 87.240.137.164:443;
}

upstream openconnect {
    server 127.0.0.1:5443;
}

server {
    listen          443;
    proxy_pass      $sni_name;
    ssl_preread     on;
}

