The domain_alias README documents alias patterns with up to three host wildcards as supported. The validator currently caps host wildcards at 1:
// DomainAliasPatternConstraintValidator::validate() $host_wildcards = substr_count($host_pattern, '*'); if ($host_wildcards > 1) { $this->context->addViolation($constraint->multipleWildcardsMessage); }
The rest of the alias pipeline has always been multi-host-wildcard ready (buildPatterns() enumerates every mask via #3588168, sort() ranks by wildcard count, buildPortPatterns() expands per-pattern). And cross-pattern alias resolution is now hardened against wildcard-count mismatches (#3588175) — the resolver returns FALSE and logs a warning rather than producing a broken URL when source and target patterns disagree.
This issue raises the host-wildcard cap to 2, as a half-step toward the README's documented "max 3" claim.
Why two and not three
Cap = 2 covers the realistic deployment patterns that operators actually want — *.*.example.com, *.example.*, example.*.* — without the broader test surface and operator visibility of a full cap=3 jump. A further raise to cap=3 (matching the README's full claim) can land as a follow-up after cap=2 has been in the wild for a release cycle and shown no regressions.
The port wildcard :* is independent and continues to be tracked separately (#3588169). Patterns like *.*.example.com:* (2 host wildcards + 1 port wildcard) are valid under the new cap.
Note on the README's historical "max 3" claim
The original domain_alias README has documented "max 3 wildcards" since the 8.x-1.x port. One plausible reading of that historical wording is that the "max 3" total counted host stars and the port :* together — e.g. example.*.*.* (3 host wildcards, 0 port) and *.example.*:* (2 host + 1 port = 3 total) both fit a "≤3 total" cap. This issue sticks with the post-#3588169 model where host and port are tracked independently: the host cap is what's raised here; the port wildcard remains capped separately by the single-colon rule.
Proposed fix
One-line change in both validators:
// DomainAliasPatternConstraintValidator + DomainAliasValidator if ($host_wildcards > 2) { $this->context->addViolation($constraint->multipleWildcardsMessage); }
Plus the corresponding test, README, form, and constraint-message updates (see MR for detail).
Dependencies
- #3588175 (resolver hardening) — merged. Required: the resolver now rejects cross-pattern resolution when source and target wildcard counts mismatch, which makes raising the host cap safe.
- #3588168 (buildPatterns completeness) — merged. Required: the candidate enumeration covers all 2^N − 2 wildcard masks, so newly-allowed multi-host-wildcard patterns can actually match.
- #3588169 (validator host/port split) — merged. Required: the host wildcard count is tracked independently from the port wildcard.
Behavior change
Strict superset; no patterns previously valid are now rejected.
- Patterns previously rejected for having two host wildcards (e.g.
*.*.example.com,*.example.*,example.*.*,*.*.example.com:*) now save successfully. - Patterns with three or more host wildcards remain rejected.
Test plan
- Add positive cases to
DomainAliasConstraintTest::testValidPatternsfor*.*.example.com,*.example.*,example.*.*,*.*.example.com:*,*.*.example.com:8080. - Negative cases: 3+ host wildcards still rejected.
- Spot-check on a multi-alias setup that previously-rejected patterns now save and that
loadByHostname()resolves them as the priority docs added in #3588155 promise.
Out of scope (separate follow-ups)
- Raising the host cap to 3 (matching the README's full claim). Defer until cap=2 has shown no regressions.
- Cross-pattern wildcard-count validation at alias save time. The runtime guard from #3588175 already handles this defensively; save-time validation would be UX polish, tracked separately if desired.
- Restoring D6/D7 single-character
?wildcard support.?is in a separate deprecation cycle (#3588169) heading toward removal indomain:4.0.0.
Issue fork domain-3588176
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mably commentedComment #4
mably commentedComment #5
mably commentedComment #7
mably commented