Repository navigation
feat: support wildcard subdomain matching in trusted_domains - #1121
Merged
Merged
Conversation
Add wildcard pattern support (e.g. `https://*.example.com`) for trusted_domains config and site URLs. This allows dynamically trusting all subdomains under a base domain without listing each one explicitly. The wildcard `*` matches exactly one subdomain level — `*.example.com` matches `sub.example.com` but not `example.com` or `a.b.example.com`. Scheme must also match. Exact domain matching is fully preserved. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
qwqcode
force-pushed
the
feat/wildcard-trusted-domains
branch
from
October 28, 2026 16:00
31cc5bc to
08fedee
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds single-level wildcard matching to
trusted_domainsand dashboard site URLs. For example,https://*.example.comallows browser requests fromhttps://blog.example.com, but not fromexample.comora.b.example.com. The scheme and port must match. This reduces configuration changes when adding subdomains.Existing exact URL matching stays unchanged, including configured paths, custom ports, localhost, and IPv6 addresses. The matcher parses URLs and rejects malformed origins. Wildcards do not authorize page-title fetching or redirects. Those requests still require an exact trusted origin. No new configuration fields or dependencies are added.
Rebased onto the current master and removed unrelated landing-page changes. Updated the English and Chinese documentation, including the need to keep a concrete first site URL when using relative page keys.
Validation: all Go tests passed with
CGO_ENABLED=0. Race tests passed for middleware, DAO, common server helpers, and handlers.go vet ./...and documentation formatting checks passed. Added tests for malformed origins, actual CORS responses and preflights, guest and authorization headers, dashboard site URLs, and title-fetch restrictions. Existing tests cover anonymous comments, page creation, and page views.