mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 08:05:49 -06:00
[GH-ISSUE #5177] Server validation rejects custom domains that merely contain subDomainHost as substring #4043
Labels
No labels
In Progress
WIP
WaitingForInfo
bug
doc
duplicate
easy
enhancement
future
help wanted
invalid
lifecycle/stale
need-issue-template
need-usage-help
no plan
proposal
pull-request
question
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/frp#4043
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @zesty-clawd on GitHub (Feb 13, 2026).
Original GitHub issue: https://github.com/fatedier/frp/issues/5177
Summary
When
subDomainHostis enabled on frps,ValidateProxyConfigurerForServerrejects custom domains that contain the subDomainHost as a substring even when they are not subdomains. This blocks legitimate custom domains such asfooexample.com.cnforsubDomainHost = example.com.Where
pkg/config/v1/validation/proxy.goinvalidateDomainConfigForServer:Repro
Actual
frpc fails with:
custom domain [fooexample.com.cn] should not belong to subdomain host [example.com]Expected
fooexample.com.cnis not a subdomain ofexample.com(it ends with.com.cn). It should be accepted.Why it happens
The validation uses
strings.Contains(domain, s.SubDomainHost), which treats any substring match as a subdomain. This causes false positives for domains that contain the subDomainHost string but are not suffix matches.Suggested fix
Use a suffix + dot-boundary check instead of substring:
(and possibly normalize/trim trailing dots before comparison).
Impact
Legitimate custom domains get rejected whenever their full name contains
subDomainHostas a substring (e.g.fooexample.com.cn,bar-example.com.net, etc.), which is surprising and blocks valid deployments.