[GH-ISSUE #4862] [Bug]: Client links are generated with localhost when 3x-ui panel is accessed through SSH tunnel #3393

Closed
opened 2026-10-31 20:32:07 +07:00 by bsakaguchi · 2 comments
Owner

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 localhost as 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

  • Panel access method: SSH local port forwarding
  • Protocol: VLESS + XTLS-RPRX-Vision

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

  • The issue only appears in generated client links.
  • The inbound configuration correctly stores the configured public address.
  • The panel appears to use the HTTP Host header from the current browser session (for example, localhost:41271 when accessed via an SSH tunnel) instead of the inbound Address field when generating client URLs.
  • Clearing webDomain does not change the behavior.
  • The problem is reproducible when the panel is accessed through an SSH tunnel.

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

  1. Configure an inbound with a valid public IP address.
  2. Bind the panel to localhost (127.0.0.1).
  3. Access the panel through an SSH tunnel using localhost.
  4. Create a new client.
  5. Copy the generated VLESS link.

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

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
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 `localhost` as 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 * Panel access method: SSH local port forwarding * Protocol: VLESS + XTLS-RPRX-Vision 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 * The issue only appears in generated client links. * The inbound configuration correctly stores the configured public address. * The panel appears to use the HTTP Host header from the current browser session (for example, `localhost:41271` when accessed via an SSH tunnel) instead of the inbound **Address** field when generating client URLs. * Clearing `webDomain` does not change the behavior. * The problem is reproducible when the panel is accessed through an SSH tunnel. ## 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 1. Configure an inbound with a valid public IP address. 2. Bind the panel to localhost (`127.0.0.1`). 3. Access the panel through an SSH tunnel using `localhost`. 4. Create a new client. 5. Copy the generated VLESS link. ### 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 ```shell ``` ### 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 - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:32:07 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@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 Host header your browser sent (localhost:41271 via the SSH tunnel). That hostname is loopback, so it ends up in the generated URL as localhost.

Verified in the source:

  • frontend/src/lib/xray/inbound-link.ts — resolveAddr() should use inbound.listen when it is a non-empty, non-0.0.0.0, non-unix-socket address. The fix restoring this logic is already merged to main but has not shipped in a tagged release yet.
  • frontend/src/pages/inbounds/useInbounds.ts line 159 — the fallback host is subDomain || webDomain || ''. When both are empty and the browser host is loopback, the fallback resolves to localhost.

Workaround (for v3.2.6)

Set the Subscription → Listen Domain (subDomain) in Panel Settings to your server's public IP or domain name:

  1. Open the panel → Settings → Subscription tab.
  2. Find the "Listen Domain" (or "Subscription Domain") field.
  3. Enter 203.0.113.10 (or your server's hostname/domain).
  4. Save.

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 like vless://…@203.0.113.10:36488?….

Note: Setting the Address field inside the inbound editor alone does not fix this in v3.2.6 — that field is currently being bypassed in the regression.

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.

<!-- gh-comment-id:4613527705 --> @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 `Host` header your browser sent (`localhost:41271` via the SSH tunnel). That hostname is loopback, so it ends up in the generated URL as `localhost`. Verified in the source: - **`frontend/src/lib/xray/inbound-link.ts`** — `resolveAddr()` should use `inbound.listen` when it is a non-empty, non-`0.0.0.0`, non-unix-socket address. The fix restoring this logic is already merged to `main` but has not shipped in a tagged release yet. - **`frontend/src/pages/inbounds/useInbounds.ts` line 159** — the fallback host is `subDomain || webDomain || ''`. When both are empty and the browser host is loopback, the fallback resolves to `localhost`. ## Workaround (for v3.2.6) Set the **Subscription → Listen Domain** (`subDomain`) in Panel Settings to your server's public IP or domain name: 1. Open the panel → **Settings** → **Subscription** tab. 2. Find the **"Listen Domain"** (or "Subscription Domain") field. 3. Enter `203.0.113.10` (or your server's hostname/domain). 4. Save. 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 like `vless://…@203.0.113.10:36488?…`. > **Note:** Setting the Address field inside the inbound editor alone does *not* fix this in v3.2.6 — that field is currently being bypassed in the regression. ## 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.
Author
Owner

@MHSanaei commented on GitHub (Jun 3, 2026):

already fixed

<!-- gh-comment-id:4613667918 --> @MHSanaei commented on GitHub (Jun 3, 2026): already fixed
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#3393
No description provided.