mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #7067] DomainValidatorMiddleware rejects a Host mismatch with an empty 403 — make it diagnosable #6605
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6605
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 @OlegEnot on GitHub (Nov 4, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/7067
Problem
When
webDomainis set, any request whoseHostdiffers gets403withContent-Length: 0(
internal/web/middleware/domainValidator.go):Nothing in the response or in the panel log says why. Clients (metrics exporters, API scripts) and
admins debugging container-to-container access see a blank 403 with valid credentials, which looks
like an authentication or API-version problem rather than a Host mismatch.
Concrete case: a metrics exporter running in Docker reaches the panel as
http://3x-ui:3053/<base-path>(service name on a shared bridge network). With
webDomain = panel.example.comevery request isrejected with an empty 403, while the same account works fine in a browser via the domain.
Suggestion
domain validation failed: host=%q expected=%q ip=%s.{"success":false,"msg":"host not allowed: configured web domain is \"panel.example.com\""}.Browser/SPA routes can keep the empty 403 if returning a body there is undesirable.
This turns a silent 403 into a one-line explanation in both the panel log and the client error.
@OlegEnot commented on GitHub (Nov 4, 2026):
Context for this report: it was found while debugging a metrics exporter (hteppl/3x-ui-exporter#18) that reported the empty 403 as an API-version mismatch.