[GH-ISSUE #5963] [Bug]: Fallbacks are not replicated to Nodes. #4132

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

Originally created by @iv7777 on GitHub (Jul 15, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5963

Describe the bug

I have setup a couple Nodes in one main panel. When I change the Fallbacks in the main panel for a remote node, the settings do not syne down to the node. Check the remote note and the Fallbacks is empty. Setting the Fallbacks in the node does not sync up to the main panel either.

How to reproduce the problem

  1. On the main panel with remote nodes, open the inbound page and edit an VLESS inbound in a remote node.
  2. Create a couple Fallbacks and Save.
  3. Open the remote node and check the settings at the same inbound. No Fallbacks are created.
  4. Create Fallbacks in the remote node
  5. Check the main panel for the same inbound, no Fallbacks are synced up.

Expected behavior

Fallbacks are expected to synced between the main panel and the remote nodes.

Actual behavior

No response

Relevant logs


Screenshots

No response

3x-ui version

3.5

Xray-core version

26.7.11

How did you install 3x-ui?

install.sh script

Operating system

Ubuntu v24

Which parts of the panel are affected?

Frontend (UI / panel pages), Multi-node (sub-nodes)

Browser (only if it is a UI bug)

No response

Is the panel behind a reverse proxy or CDN?

No response

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 @iv7777 on GitHub (Jul 15, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5963 ### Describe the bug I have setup a couple Nodes in one main panel. When I change the Fallbacks in the main panel for a remote node, the settings do not syne down to the node. Check the remote note and the Fallbacks is empty. Setting the Fallbacks in the node does not sync up to the main panel either. ### How to reproduce the problem 1. On the main panel with remote nodes, open the inbound page and edit an VLESS inbound in a remote node. 2. Create a couple Fallbacks and Save. 3. Open the remote node and check the settings at the same inbound. No Fallbacks are created. 5. Create Fallbacks in the remote node 6. Check the main panel for the same inbound, no Fallbacks are synced up. ### Expected behavior Fallbacks are expected to synced between the main panel and the remote nodes. ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.5 ### Xray-core version 26.7.11 ### How did you install 3x-ui? install.sh script ### Operating system Ubuntu v24 ### Which parts of the panel are affected? Frontend (UI / panel pages), Multi-node (sub-nodes) ### Browser (only if it is a UI bug) _No response_ ### Is the panel behind a reverse proxy or CDN? _No response_ ### 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:37:25 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@github-actions[bot] commented on GitHub (Jul 15, 2026):

Confirmed as a real defect: fallback rules do not cross the master↔node boundary in either direction, and the root cause is fully traceable in the current code.

Title: Fallback rules are excluded from both the master→node push and the node→master pull

Severity: Medium

Category: Correctness

Why this matters:
Fallbacks are not part of an inbound's settings JSON at rest — they live in a separate inbound_fallbacks table (model.InboundFallback, internal/database/model/model.go:933-945), whose master_id/child_id reference local inbounds.id rows. That table only gets merged into the actual settings.fallbacks array inside XrayService.GetXrayConfig (internal/web/service/xray.go:109, merge logic at lines 231-244 via FallbackService.BuildFallbacksJSON) — the function that builds the config for the locally-run Xray-core process. That same function explicitly skips node-hosted inbounds a few lines earlier:

// internal/web/service/xray.go:139-141
if inbound.NodeID != nil {
    continue
}

So for any inbound assigned to a node, this merge never runs on the master.

  • Main panel → node: setFallbacks (internal/web/controller/inbound.go:459-479) does persist your fallback rows to the master's own inbound_fallbacks table and calls xrayService.SetToNeedRestart() — but that only restarts the master's own local Xray process, which (per the skip above) never runs node inbounds anyway. The actual payload pushed to a node — built by wireInbound() in internal/web/runtime/remote.go:744-774 and used by AddInbound/UpdateInbound/ReconcileInbound — sets settings straight from the raw ib.Settings DB column and never calls BuildFallbacksJSON. So the rule is saved centrally but never transmitted to the node, regardless of when or how often a resync runs.
  • Node → main panel: there's no pull path at all. FetchTrafficSnapshot (internal/web/runtime/remote.go:694-728) only fetches panel/api/inbounds/list (again the raw settings column) plus online-client data. Host/TLS overrides do have a dedicated fetch (FetchHostGroups / panel/api/hosts/list), but there is no equivalent endpoint exposing a node's own inbound_fallbacks rows back to the master.

This matches the reported repro exactly: fallbacks set on either side are invisible to the other.

Recommendation: Two separate fixes are needed, since child_id is a foreign key local to whichever panel's database holds it and can't be shipped as-is to the other side:

  • Master→node: in or before wireInbound(), resolve the master's fallback rows for that inbound (reusing FallbackService.BuildFallbacksJSON, which already resolves a child inbound to a host:port dest string) and merge the result into the outgoing settings JSON, mirroring what GetXrayConfig already does for locally-run inbounds.
  • Node→master: add a node-side endpoint analogous to panel/api/hosts/list/FetchHostGroups that exposes the node's own inbound_fallbacks rows, and adopt it in the traffic-snapshot flow (FetchTrafficSnapshot plus setRemoteTrafficLocked in internal/web/service/inbound_node.go), translating the node's local child-inbound IDs to the master's corresponding central inbound IDs.

A maintainer should decide which side is authoritative (master pushes only vs. genuine two-way merge) before implementing, since naive bidirectional sync can conflict if both panels are edited between polls.

Confidence: High for the root cause — traced end to end through the exact functions above on the current main branch (matches the reported v3.5.0). The two-fix split above is a suggested approach, not a spec; a fix will only be made if @MHSanaei requests it by mentioning @claude.

@MHSanaei

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:4976227312 --> @github-actions[bot] commented on GitHub (Jul 15, 2026): Confirmed as a real defect: fallback rules do not cross the master↔node boundary in either direction, and the root cause is fully traceable in the current code. **Title:** Fallback rules are excluded from both the master→node push and the node→master pull **Severity:** Medium **Category:** Correctness **Why this matters:** Fallbacks are not part of an inbound's `settings` JSON at rest — they live in a separate `inbound_fallbacks` table (`model.InboundFallback`, `internal/database/model/model.go:933-945`), whose `master_id`/`child_id` reference local `inbounds.id` rows. That table only gets merged into the actual `settings.fallbacks` array inside `XrayService.GetXrayConfig` (`internal/web/service/xray.go:109`, merge logic at lines 231-244 via `FallbackService.BuildFallbacksJSON`) — the function that builds the config for the **locally-run** Xray-core process. That same function explicitly skips node-hosted inbounds a few lines earlier: ```go // internal/web/service/xray.go:139-141 if inbound.NodeID != nil { continue } ``` So for any inbound assigned to a node, this merge never runs on the master. - **Main panel → node:** `setFallbacks` (`internal/web/controller/inbound.go:459-479`) does persist your fallback rows to the master's own `inbound_fallbacks` table and calls `xrayService.SetToNeedRestart()` — but that only restarts the master's own local Xray process, which (per the skip above) never runs node inbounds anyway. The actual payload pushed to a node — built by `wireInbound()` in `internal/web/runtime/remote.go:744-774` and used by `AddInbound`/`UpdateInbound`/`ReconcileInbound` — sets `settings` straight from the raw `ib.Settings` DB column and never calls `BuildFallbacksJSON`. So the rule is saved centrally but never transmitted to the node, regardless of when or how often a resync runs. - **Node → main panel:** there's no pull path at all. `FetchTrafficSnapshot` (`internal/web/runtime/remote.go:694-728`) only fetches `panel/api/inbounds/list` (again the raw `settings` column) plus online-client data. Host/TLS overrides do have a dedicated fetch (`FetchHostGroups` / `panel/api/hosts/list`), but there is no equivalent endpoint exposing a node's own `inbound_fallbacks` rows back to the master. This matches the reported repro exactly: fallbacks set on either side are invisible to the other. **Recommendation:** Two separate fixes are needed, since `child_id` is a foreign key local to whichever panel's database holds it and can't be shipped as-is to the other side: - Master→node: in or before `wireInbound()`, resolve the master's fallback rows for that inbound (reusing `FallbackService.BuildFallbacksJSON`, which already resolves a child inbound to a `host:port` `dest` string) and merge the result into the outgoing `settings` JSON, mirroring what `GetXrayConfig` already does for locally-run inbounds. - Node→master: add a node-side endpoint analogous to `panel/api/hosts/list`/`FetchHostGroups` that exposes the node's own `inbound_fallbacks` rows, and adopt it in the traffic-snapshot flow (`FetchTrafficSnapshot` plus `setRemoteTrafficLocked` in `internal/web/service/inbound_node.go`), translating the node's local child-inbound IDs to the master's corresponding central inbound IDs. A maintainer should decide which side is authoritative (master pushes only vs. genuine two-way merge) before implementing, since naive bidirectional sync can conflict if both panels are edited between polls. **Confidence:** High for the root cause — traced end to end through the exact functions above on the current `main` branch (matches the reported v3.5.0). The two-fix split above is a suggested approach, not a spec; a fix will only be made if @MHSanaei requests it by mentioning @claude. @MHSanaei *This reply was generated automatically; a maintainer may follow up.*
Author
Owner

@MHSanaei commented on GitHub (Jul 23, 2026):

Fixed in #6083. The node runtime payload now injects settings.fallbacks and the reconcile job fingerprints it, so inbound fallbacks replicate to nodes.

<!-- gh-comment-id:5059095583 --> @MHSanaei commented on GitHub (Jul 23, 2026): Fixed in #6083. The node runtime payload now injects settings.fallbacks and the reconcile job fingerprints it, so inbound fallbacks replicate to nodes.
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#4132
No description provided.