mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[GH-ISSUE #6251] [Question]: Custom domain override for client links #4240
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#4240
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 @BismuthumOS on GitHub (Aug 18, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6251
What are you trying to do?
Hello!
My 3x-ui panel is running on docker and bound to 127.0.0.1 for security. I open the web panel on my PC via an SSH tunnel at http://localhost:2053. Because of this, all generated client links (vless, hysteria, etc.) contain "localhost" instead of my actual domain or server IP The panel takes the address directly from my browser URL or something?
And I have to manually edit my client URLs to my actual Domain every time I generate them. Is it possible to add a simple setting in the panel to force a specific default domain or IP for all generated client links? Or maybe I missed some env variable/web ui setting?
Thank you!
What have you already tried?
No response
3x-ui version
3.6.0
How did you install 3x-ui?
Docker / Docker Compose
Operating system
Debian 13
Screenshots or config snippets
No response
Before submitting
@github-actions[bot] commented on GitHub (Aug 18, 2026):
The setting already exists in 3.6.0 — the panel only falls back to your browser's hostname when no public host is configured, so nothing needs to be added.
How the link host is chosen (paths/line numbers from current
main):frontend/src/pages/inbounds/InboundsPage.tsx:288passespreferPublicHost(window.location.hostname, subSettings.publicHost)as the last-resort host intoresolveShareHost(frontend/src/lib/xray/inbound-link.ts:1010), wherepublicHostissubDomain || webDomain(frontend/src/pages/inbounds/useInbounds.ts:179).resolveInboundAddressandconfiguredPublicHost(internal/sub/service.go:1162and:210).subDomain, thenwebDomain), then the host your browser used.localhost,127.xand::1are rejected as link hosts (isShareableHost,inbound-link.ts:974), so with nothing configured the browser host is the only candidate left. That is exactly what you are seeing.Two ways to fix it:
subDomain). Set it to your FQDN or public IP.Note that
subDomainalso installs a Host-header check on the subscription server (port 2096):internal/sub/sub.go:63wiresDomainValidatorMiddleware, so requests to the sub server whose Host is not exactly that value get403. It does not affect panel access.shareAddrStrategy/shareAddrininternal/database/model/model.go.One thing to avoid: do not use Settings → General → Listen Domain (
webDomain) for this. It enablesDomainValidatorMiddlewareon the panel itself (internal/web/web.go:182), which returns403for any request whose Host is not that domain — you would lose access tohttp://localhost:2053through your SSH tunnel. It is only consulted as the public-host fallback whensubDomainis empty.Closing this as a duplicate of #6013, which is the same scenario (panel reached over an SSH tunnel on a loopback host) with the same resolution. Please continue the discussion there if the above does not cover your case.
This reply was generated automatically; a maintainer may follow up.