# HG changeset patch # User Kim Alvefur # Date 1620229971 -7200 # Node ID 180c5951e7e470145c487316a160cfdc366f041e # Parent 1cef62ca3e030863a39ce70d261f81ac50d34859 core.portmanager: Allow overriding expected SNI name per service E.g. VirtualHost"example.com" https_name = "xmpp.example.com" diff -r 1cef62ca3e03 -r 180c5951e7e4 core/portmanager.lua --- a/core/portmanager.lua Wed May 05 15:56:39 2021 +0200 +++ b/core/portmanager.lua Wed May 05 17:52:51 2021 +0200 @@ -237,11 +237,12 @@ local config_prefix = (active_service.config_prefix or name).."_"; if config_prefix == "_" then config_prefix = ""; end local prefix_ssl_config = config.get(host, config_prefix.."ssl"); - local autocert = certmanager.find_host_cert(host); + local alternate_host = service and config.get(host, service.."_host"); + local autocert = certmanager.find_host_cert(alternate_host or host); -- luacheck: ignore 211/cfg local ssl, err, cfg = certmanager.create_context(host, "server", prefix_ssl_config, autocert, active_service.tls_cfg); if ssl then - active_service.server.hosts[host] = ssl; + active_service.server.hosts[alternate_host or host] = ssl; else log("error", "Error creating TLS context for SNI host %s: %s", host, err); end