[GH-ISSUE #5078] [Bug]: Adding a Fallback to another Inbound changes the Fallback's Subscription IP and port #3575

Closed
opened 2026-10-31 20:33:26 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @herotm on GitHub (Jun 8, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5078

Describe the bug

I added a Fallback to a Inbound, went to update my subscription on my app, then realized the Fallback's ip and port was changed to the original one.

How to reproduce the problem

  1. Click Inbounds
  2. Modify an Inbound
  3. Add Fallback to another inbound
  4. Update Subscription
  5. Incorrect Fallback's IP and Port.

Expected behavior

No response

Actual behavior

No response

Relevant logs


Screenshots

No response

3x-ui version

3.2.8

Xray-core version

26.6.1

How did you install 3x-ui?

Docker / Docker Compose

Operating system

Ubuntu 26.04

Which parts of the panel are affected?

Subscription (share links / Clash / JSON)

Browser (only if it is a UI bug)

No response

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 @herotm on GitHub (Jun 8, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5078 ### Describe the bug I added a Fallback to a Inbound, went to update my subscription on my app, then realized the Fallback's ip and port was changed to the original one. ### How to reproduce the problem 1. Click Inbounds 2. Modify an Inbound 3. Add Fallback to another inbound 4. Update Subscription 5. Incorrect Fallback's IP and Port. ### Expected behavior _No response_ ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.2.8 ### Xray-core version 26.6.1 ### How did you install 3x-ui? Docker / Docker Compose ### Operating system Ubuntu 26.04 ### Which parts of the panel are affected? Subscription (share links / Clash / JSON) ### Browser (only if it is a UI bug) _No response_ ### 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:33:26 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Jun 8, 2026):

Thanks for the report. I traced how the subscription generator handles fallback children in the current code (v3.2.8).

What the code does

sub/subService.go — projectThroughFallbackMaster() — runs on every inbound before its subscription link is generated. It looks up the inbound_fallbacks table for a matching child_id = <inbound.Id> row and, if found, replaces the child's Listen, Port, and TLS/security stream settings with the master's values.

Crucially, it only does this when the child inbound's Listen field is "internal only" (listenIsInternalOnly, lines 99-107):

  • A loopback IP: 127.0.0.1, ::1, etc.
  • A Unix-domain socket: starts with @ or /
  • An empty string ("", i.e. wildcard / all interfaces) → projection does NOT happen — the child advertises its own port/address.

So whether the fallback subscription is rewritten depends entirely on what the child inbound's Listen field is set to.

Why this matters for your setup

When you use the panel's fallback feature, BuildFallbacksJSON (web/service/fallback.go lines 130-134) writes the Xray config with the fallback destination set to 127.0.0.1:<child_port> whenever the child's Listen is empty or 0.0.0.0. This is correct for Xray — the parent forwards traffic internally. However, the child's stored Listen in the database is not modified by adding a fallback.

Subscription projection only fires when the stored Listen is a loopback or socket address. If your child inbound has an explicit Listen = 127.0.0.1, it cannot be reached directly by external clients — so showing the master's address and port in the subscription is the intended behavior.

To narrow down the actual bug

Please share the following:

  1. Child inbound's "Listen" field — what address is shown in the panel's inbound edit form under "Listen IP"? (e.g., empty, 0.0.0.0, 127.0.0.1, or something else)
  2. Protocol of both inbounds — e.g., master = VLESS + REALITY on port 443, child = VLESS + WS on port 8080.
  3. Specific symptom — what does the subscription link look like? Does it show the master's port, the master's IP, both, or something else?

If the child's Listen is empty or a public address and the subscription is still being rewritten to the master's port, that would be a genuine bug in the guard logic and we'd want to dig into the exact Xray/DB state.

<!-- gh-comment-id:4649595178 --> @github-actions[bot] commented on GitHub (Jun 8, 2026): Thanks for the report. I traced how the subscription generator handles fallback children in the current code (v3.2.8). ## What the code does `sub/subService.go` — `projectThroughFallbackMaster()` — runs on every inbound before its subscription link is generated. It looks up the `inbound_fallbacks` table for a matching `child_id = <inbound.Id>` row and, if found, replaces the child's `Listen`, `Port`, and TLS/security stream settings with the master's values. **Crucially**, it only does this when the child inbound's `Listen` field is "internal only" (`listenIsInternalOnly`, lines 99-107): - A loopback IP: `127.0.0.1`, `::1`, etc. - A Unix-domain socket: starts with `@` or `/` - An empty string (`""`, i.e. wildcard / all interfaces) → **projection does NOT happen** — the child advertises its own port/address. So whether the fallback subscription is rewritten depends entirely on what the child inbound's **Listen** field is set to. ## Why this matters for your setup When you use the panel's fallback feature, `BuildFallbacksJSON` (`web/service/fallback.go` lines 130-134) writes the Xray config with the fallback destination set to `127.0.0.1:<child_port>` whenever the child's Listen is empty or `0.0.0.0`. This is correct for Xray — the parent forwards traffic internally. However, the child's stored `Listen` in the database is **not modified** by adding a fallback. Subscription projection only fires when the stored `Listen` is a loopback or socket address. If your child inbound has an explicit `Listen = 127.0.0.1`, it **cannot** be reached directly by external clients — so showing the master's address and port in the subscription is the **intended behavior**. ## To narrow down the actual bug Please share the following: 1. **Child inbound's "Listen" field** — what address is shown in the panel's inbound edit form under "Listen IP"? (e.g., empty, `0.0.0.0`, `127.0.0.1`, or something else) 2. **Protocol of both inbounds** — e.g., master = VLESS + REALITY on port 443, child = VLESS + WS on port 8080. 3. **Specific symptom** — what does the subscription link look like? Does it show the master's port, the master's IP, both, or something else? If the child's Listen is empty or a public address and the subscription is still being rewritten to the master's port, that would be a genuine bug in the guard logic and we'd want to dig into the exact Xray/DB state.
Author
Owner

@routegg commented on GitHub (Jun 9, 2026):

fallback is not working

<!-- gh-comment-id:4655819092 --> @routegg commented on GitHub (Jun 9, 2026): fallback is not working
Author
Owner

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

Fixed in 2b4e199a. Subscription output now only projects an inbound through a fallback master when that inbound listens on an internal-only address (loopback or a unix socket). Inbounds bound to a public/wildcard address advertise their own port and security settings again, so adding a fallback that points at another inbound no longer rewrites that inbound''s subscription IP/port. The fix will be in the next release.

<!-- gh-comment-id:4685768252 --> @MHSanaei commented on GitHub (Jun 11, 2026): Fixed in 2b4e199a. Subscription output now only projects an inbound through a fallback master when that inbound listens on an internal-only address (loopback or a unix socket). Inbounds bound to a public/wildcard address advertise their own port and security settings again, so adding a fallback that points at another inbound no longer rewrites that inbound''s subscription IP/port. The fix will be in the next release.
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#3575
No description provided.