core.portmanager: Use existing http_host for https SNI mapping
authorKim Alvefur <zash@zash.se>
Wed, 05 May 2021 17:54:44 +0200
changeset 11540 fb9bd9fa4356
parent 11539 180c5951e7e4
child 11541 a09685a7b330
core.portmanager: Use existing http_host for https SNI mapping
core/portmanager.lua
--- a/core/portmanager.lua	Wed May 05 17:52:51 2021 +0200
+++ b/core/portmanager.lua	Wed May 05 17:54:44 2021 +0200
@@ -238,6 +238,10 @@
 			if config_prefix == "_" then config_prefix = ""; end
 			local prefix_ssl_config = config.get(host, config_prefix.."ssl");
 			local alternate_host = service and config.get(host, service.."_host");
+			if not alternate_host and service == "https" then
+				-- TODO should this be some generic thing? e.g. in the service definition
+				alternate_host = config.get(host, "http_host");
+			end
 			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);