mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-11-16 23:04:24 +08:00
feat(domain): 支持通配符域名及关联功能适配 (#63)
* feat(domain): 支持通配符域名及关联功能适配 * fix(domain): preserve legacy Unicode imports and address review findings * fix(domain): canonicalize legacy IDNs and exclude empty host labels * fix(domain): normalize equivalent Unicode IDN spellings --------- Co-authored-by: Ryan <63696351+Rain-kl@users.noreply.github.com> Co-authored-by: ryan <ryan@arctel.net>
This commit is contained in:
@@ -229,11 +229,17 @@ func routeMonitorURL(ctx context.Context, route *model.ProxyRoute) (string, erro
|
||||
if len(domains) == 0 {
|
||||
return "", fmt.Errorf("route %s has no zone domains", route.SiteName)
|
||||
}
|
||||
domain := domains[0].Domain
|
||||
if route.EnableHTTPS {
|
||||
return "https://" + domain, nil
|
||||
// 通配符是匹配规则而非可探测地址;混合绑定时选择具体域名。
|
||||
for _, domain := range domains {
|
||||
if strings.Contains(domain.Domain, "*") {
|
||||
continue
|
||||
}
|
||||
if route.EnableHTTPS {
|
||||
return "https://" + domain.Domain, nil
|
||||
}
|
||||
return "http://" + domain.Domain, nil
|
||||
}
|
||||
return "http://" + domain, nil
|
||||
return "", fmt.Errorf("route %s only has wildcard domains; bind a concrete hostname for monitoring", route.SiteName)
|
||||
}
|
||||
|
||||
func monitorPayload(id int, name, targetURL string, config *kumaConfig) map[string]any {
|
||||
|
||||
Reference in New Issue
Block a user