Skip to content

Commit ab024c6

Browse files
committed
Serve correct TLS certificate for requests with uppercase host
1 parent 36f7dd2 commit ab024c6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

rootfs/etc/nginx/lua/certificate.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ local function set_der_cert_and_key(der_cert, der_priv_key)
4242
end
4343

4444
local function get_pem_cert_uid(raw_hostname)
45-
local hostname = re_sub(raw_hostname, "\\.$", "", "jo")
45+
-- Convert hostname to ASCII lowercase (see RFC 6125 6.4.1) so that requests with uppercase
46+
-- host would lead to the right certificate being chosen (controller serves certificates for
47+
-- lowercase hostnames as specified in Ingress object's spec.rules.host)
48+
local hostname = re_sub(raw_hostname, "\\.$", "", "jo"):gsub("[A-Z]", function(c) return c:lower() end)
4649

4750
local uid = certificate_servers:get(hostname)
4851
if uid then

0 commit comments

Comments
 (0)