nic-6443 commented on code in PR #12668:
URL: https://github.com/apache/apisix/pull/12668#discussion_r2428086627
##########
apisix/ssl/router/radixtree_sni.lua:
##########
@@ -171,6 +176,33 @@ function _M.match_and_set(api_ctx, match_only, alt_sni)
local sni_rev = sni:reverse()
local ok = radixtree_router:dispatch(sni_rev, nil, api_ctx)
+
+ -- if no SSL matched, try to find a wildcard SSL
+ if not ok then
+ for _, ssl in config_util.iterate_values(ssl_certificates.values) do
+ if ssl.value and ssl.value.type == "server" and
+ (ssl.value.status == nil or ssl.value.status == 1) then
+ local has_wildcard = false
+ if ssl.value.sni == "*" then
+ has_wildcard = true
+ elseif type(ssl.value.snis) == "table" then
+ for _, s in ipairs(ssl.value.snis) do
+ if s == "*" then
+ has_wildcard = true
+ break
+ end
+ end
+ end
+ if has_wildcard then
+ api_ctx.matched_ssl = ssl
+ api_ctx.matched_sni = "*"
+ ok = true
+ break
+ end
+ end
+ end
+ end
Review Comment:
This is more complicated than I imagined, is it necessary? For
[lua-resty-radixtree](https://github.com/api7/lua-resty-radixtree), what will
be the behavior of a single wildcard when matching?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]