Comparison

core/portmanager.lua @ 11536:fb9bd9fa4356

core.portmanager: Use existing http_host for https SNI mapping
author Kim Alvefur <zash@zash.se>
date Wed, 05 May 2021 17:54:44 +0200
parent 11535:180c5951e7e4
child 11590:5aafb832c91b
comparison
equal deleted inserted replaced
11535:180c5951e7e4 11536:fb9bd9fa4356
236 if active_service.server.hosts and active_service.tls_cfg then 236 if active_service.server.hosts and active_service.tls_cfg then
237 local config_prefix = (active_service.config_prefix or name).."_"; 237 local config_prefix = (active_service.config_prefix or name).."_";
238 if config_prefix == "_" then config_prefix = ""; end 238 if config_prefix == "_" then config_prefix = ""; end
239 local prefix_ssl_config = config.get(host, config_prefix.."ssl"); 239 local prefix_ssl_config = config.get(host, config_prefix.."ssl");
240 local alternate_host = service and config.get(host, service.."_host"); 240 local alternate_host = service and config.get(host, service.."_host");
241 if not alternate_host and service == "https" then
242 -- TODO should this be some generic thing? e.g. in the service definition
243 alternate_host = config.get(host, "http_host");
244 end
241 local autocert = certmanager.find_host_cert(alternate_host or host); 245 local autocert = certmanager.find_host_cert(alternate_host or host);
242 -- luacheck: ignore 211/cfg 246 -- luacheck: ignore 211/cfg
243 local ssl, err, cfg = certmanager.create_context(host, "server", prefix_ssl_config, autocert, active_service.tls_cfg); 247 local ssl, err, cfg = certmanager.create_context(host, "server", prefix_ssl_config, autocert, active_service.tls_cfg);
244 if ssl then 248 if ssl then
245 active_service.server.hosts[alternate_host or host] = ssl; 249 active_service.server.hosts[alternate_host or host] = ssl;