Serve correct TLS certificate for requests with uppercase host

This commit is contained in:
Andreas Sommer 2020-06-05 17:19:09 +02:00 committed by Manuel Alejandro de Brito Fontes
parent 3d3efaab29
commit f27b404421

View file

@ -46,7 +46,10 @@ local function set_der_cert_and_key(der_cert, der_priv_key)
end
local function get_pem_cert_uid(raw_hostname)
local hostname = re_sub(raw_hostname, "\\.$", "", "jo")
-- Convert hostname to ASCII lowercase (see RFC 6125 6.4.1) so that requests with uppercase
-- host would lead to the right certificate being chosen (controller serves certificates for
-- lowercase hostnames as specified in Ingress object's spec.rules.host)
local hostname = re_sub(raw_hostname, "\\.$", "", "jo"):gsub("[A-Z]", function(c) return c:lower() end)
local uid = certificate_servers:get(hostname)
if uid then