Skip to content

Commit 10fc88a

Browse files
Merge pull request #62 from fosrl/dev
Pull the hostregex domains for wildcard resources
2 parents afae589 + a2ae71b commit 10fc88a

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

server/lib/traefik/TraefikConfigManager.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,24 @@ export class TraefikConfigManager {
527527
if (match && match[1]) {
528528
domains.add(match[1]);
529529
}
530+
// Match HostRegexp(`^[^.]+\.parent.domain$`) generated for wildcard resources
531+
const hostRegexpMatch = router.rule.match(
532+
/HostRegexp\(`([^`]+)`\)/
533+
);
534+
if (hostRegexpMatch && hostRegexpMatch[1]) {
535+
const innerRegex = hostRegexpMatch[1];
536+
// Pattern is always ^[^.]+\.PARENT_DOMAIN$ where dots are escaped as \.
537+
const domainMatch = innerRegex.match(
538+
/^\^\[\^\.\]\+\\\.(.+)\$$/
539+
);
540+
if (domainMatch && domainMatch[1]) {
541+
const parentDomain = domainMatch[1].replace(
542+
/\\\./g,
543+
"."
544+
);
545+
domains.add(`*.${parentDomain}`);
546+
}
547+
}
530548
}
531549
}
532550
}

0 commit comments

Comments
 (0)