mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #4862] [Bug]: Client links are generated with localhost when 3x-ui panel is accessed through SSH tunnel #3393
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#3393
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 @dicreat on GitHub (Jun 3, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4862
Describe the bug
When accessing the 3x-ui web panel through an SSH local port forwarding tunnel, newly generated client links incorrectly use
localhostas the server address, even though the inbound is configured with a valid public IP address.As a result, generated VLESS URLs are unusable for end users because they contain:
vless://UUID@localhost:36488?...
instead of the configured public server address.
Configuration and environment
webListen = 127.0.0.1
webPort = 41271
webDomain = (empty)
The panel is intentionally bound to localhost for security reasons and is accessed only through an SSH tunnel.
Inbound configuration
Inbound record:
listen = 203.0.113.10
port = 36488
protocol = vless
The Address field in the inbound editor is correctly configured with the public IP address:
203.0.113.10
SSH tunnel
The panel is accessed using:
ssh -L 41271:127.0.0.1:41271 root@server
and opened in a browser as:
https://localhost:41271/
Additional observations
localhost:41271when accessed via an SSH tunnel) instead of the inbound Address field when generating client URLs.webDomaindoes not change the behavior.Impact
Administrators who secure the panel by binding it to localhost and accessing it through SSH tunnels receive invalid client links containing
localhost, which cannot be used by remote users without manual editing.How to reproduce the problem
127.0.0.1).localhost.Expected behavior
Generated link should use the inbound address:
vless://UUID@203.0.113.10:36488?encryption=none&flow=xtls-rprx-vision...
or another explicitly configured public host/domain.
Actual behavior
Generated link:
vless://UUID@localhost:36488?encryption=none&flow=xtls-rprx-vision...
Relevant logs
Screenshots
No response
3x-ui version
3.2.6
Xray-core version
No response
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu
Which parts of the panel are affected?
No response
Browser (only if it is a UI bug)
Chrome
Is the panel behind a reverse proxy or CDN?
None
Before submitting
@github-actions[bot] commented on GitHub (Jun 3, 2026):
Thanks for the detailed report, @dicreat.
Root cause
This is a confirmed regression introduced in v3.2.5/3.2.6 (also reported in #4798 and #4829). In the current release, when generating share/copy links from the panel UI, the inbound's Listen address is no longer used — the code falls through to the fallback hostname, which is derived from the HTTP
Hostheader your browser sent (localhost:41271via the SSH tunnel). That hostname is loopback, so it ends up in the generated URL aslocalhost.Verified in the source:
frontend/src/lib/xray/inbound-link.ts—resolveAddr()should useinbound.listenwhen it is a non-empty, non-0.0.0.0, non-unix-socket address. The fix restoring this logic is already merged tomainbut has not shipped in a tagged release yet.frontend/src/pages/inbounds/useInbounds.tsline 159 — the fallback host issubDomain || webDomain || ''. When both are empty and the browser host is loopback, the fallback resolves tolocalhost.Workaround (for v3.2.6)
Set the Subscription → Listen Domain (
subDomain) in Panel Settings to your server's public IP or domain name:203.0.113.10(or your server's hostname/domain).After this, when the browser accesses the panel on a loopback host (
localhost),preferPublicHost()will substitute your configured domain/IP as the fallback, producing correct share links likevless://…@203.0.113.10:36488?….Fix status
The owner confirmed the fix in #4798 ("Will ship in the next release"). It is already in
main. Watch for the release after v3.2.6.@MHSanaei commented on GitHub (Jun 3, 2026):
already fixed