[GH-ISSUE #6835] [Bug]: عدم کارکرد Fallback در صورت روشن کردن Proxy Protocol #4547

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

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

Describe the bug

درود
برای راه اندازی سرویس فالبک ، وقتی که سرویس های روی 127.0.0.1 ، تیک
Proxy Protocol
رو فعال میکنم، کانفیگ کار نمیده

ولی وقتی که خاموش میکنم بدرستی کار میده

از آخرین نسخه استفاده شد

How to reproduce the problem

https://www.youtube.com/watch?v=jK7E-5yv_2s
طبق این آموزش رفتم جلو

هر کاری میکردم توی حالت فالبک اتصال برای اینباندهای وابسته برقرار نمیشد
با خاموش کردن
Proxy Protocol
مشکل رفع شد

Image

Expected behavior

No response

Actual behavior

No response

Relevant logs


Screenshots

No response

3x-ui version

3.10.2

Xray-core version

No response

How did you install 3x-ui?

install.sh script

Operating system

Ubuntu 24

Which parts of the panel are affected?

No response

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 @URT19 on GitHub (Oct 15, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6835 ### Describe the bug درود برای راه اندازی سرویس فالبک ، وقتی که سرویس های روی 127.0.0.1 ، تیک Proxy Protocol رو فعال میکنم، کانفیگ کار نمیده ولی وقتی که خاموش میکنم بدرستی کار میده از آخرین نسخه استفاده شد ### How to reproduce the problem https://www.youtube.com/watch?v=jK7E-5yv_2s طبق این آموزش رفتم جلو هر کاری میکردم توی حالت فالبک اتصال برای اینباندهای وابسته برقرار نمیشد با خاموش کردن Proxy Protocol مشکل رفع شد <img width="775" height="617" alt="Image" src="https://github.com/user-attachments/assets/f26ba4d8-1c08-4b61-9e54-1903b7b84406" /> ### Expected behavior _No response_ ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.10.2 ### Xray-core version _No response_ ### How did you install 3x-ui? install.sh script ### Operating system Ubuntu 24 ### Which parts of the panel are affected? _No response_ ### 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:40:25 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@MHSanaei commented on GitHub (Oct 16, 2026):

@claude analyze

<!-- gh-comment-id:6212778114 --> @MHSanaei commented on GitHub (Oct 16, 2026): @claude analyze
Author
Owner

@github-actions[bot] commented on GitHub (Oct 16, 2026):

نتیجه: وقتی تیک Proxy Protocol را روی اینباند مقصد (روی 127.0.0.1) روشن می‌کنید، باید در ردیف Fallback همان اینباند در اینباند اصلی، مقدار xver را هم روی 1 یا 2 بگذارید. پنل این مقدار را خودکار پر نمی‌کند و همیشه 0 می‌گذارد. با xver = 0، اینباند اصلی هدر PROXY را برای مقصد نمی‌فرستد، ولی مقصد منتظر آن هدر است و اتصال برقرار نمی‌شود. این همان چیزی است که دیدید: با خاموش کردن Proxy Protocol مشکل برطرف می‌شود.

راه‌حل فعلی:

  1. اینباند اصلی (VLESS/Trojan روی پورت عمومی) را ویرایش کنید.
  2. در کارت Fallbacks، برای هر ردیفی که اینباند مقصدش Proxy Protocol را فعال دارد، فیلد
    xver
    را روی 1 یا 2 بگذارید و ذخیره کنید.
  3. برای ردیف‌هایی که مقصدشان Proxy Protocol ندارد، xver را روی 0 نگه دارید.

نمی‌توانم تصویر پیوست را باز کنم. اگر با xver غیرصفر هم کار نکرد، لطفاً بخش fallbacks از کانفیگ Xray اینباند اصلی و streamSettings اینباند مقصد را به‌صورت متن (با حذف اطلاعات حساس) بفرستید.


Verdict:        Confirmed bug
Severity:       Low
Confidence:     Medium
Root cause:     frontend/src/pages/inbounds/form/useInboundFallbacks.ts:104, deriveFallbackDefaults()
                hard-codes `return { name: sni, alpn, path, xver: 0 };` and never reads the child's
                acceptProxyProtocol. That contradicts the function's own comment (lines 79-80):
                "xver stays 0 unless the child explicitly opts in via PROXY-protocol sockopt."
                So a child with Proxy Protocol enabled is wired with xver 0: the master sends no
                PROXY header, and the child (expecting one) rejects the connection.
                Present since d1882c7f (refactor(frontend): reorganize source tree ... #4698).
Same class:     - frontend/src/pages/inbounds/form/useInboundFallbacks.ts:132 (updateFallback, auto-fill on child pick)
                - frontend/src/pages/inbounds/form/useInboundFallbacks.ts:174 (addAllFallbacks, `xver: derived.xver ?? 0`)
                - internal/web/service/fallback.go:149-150 BuildFallbacksJSON emits only the stored row's
                  xver (`if r.Xver > 0 { entry["xver"] = r.Xver }`), so turning Proxy Protocol on for a
                  child that is already wired never changes the fallback.
Already fixed:  Still present on the default branch (608ef4e4, v3.10.2)
Duplicate of:   None (#6313 is a Reality→XHTTP fallback that was fixed by a restart, a different cause)
Evidence:       - useInboundFallbacks.ts:104 `return { name: sni, alpn, path, xver: 0 };`
                - FallbacksCard.tsx:143-150 xver is a manual InputNumber (min 0, max 2) per row: the workaround
                - fallback.go:137-151 the generated fallback entry carries only dest/name/alpn/path/xver from the row
Not determined: Whether the reporter's fallback rows actually had xver 0 (the screenshot is unreadable here).
                That Xray closes a connection without a PROXY header when acceptProxyProtocol is on is
                Xray-core behaviour (per its sockopt docs), not verified against Xray source in this checkout.
                The fallbacks block of the generated config.json would settle it.

Suggested fix: in deriveFallbackDefaults, read the child's streamSettings.sockopt.acceptProxyProtocol and the transport-level acceptProxyProtocol (tcpSettings / wsSettings / httpupgradeSettings), and return a non-zero xver when either is set, as the comment already says it should. That only covers rows auto-filled from now on. A fallback that is already wired and whose child turns Proxy Protocol on later would still be broken. A warning in the Fallbacks card when a row has xver 0 and its child accepts PROXY would cover that case too.

این پاسخ به‌صورت خودکار تولید شده است؛ ممکن است نگهدارنده‌ی پروژه پیگیری کند.

<!-- gh-comment-id:6212812658 --> @github-actions[bot] commented on GitHub (Oct 16, 2026): **نتیجه:** وقتی تیک Proxy Protocol را روی اینباند مقصد (روی `127.0.0.1`) روشن می‌کنید، باید در ردیف Fallback همان اینباند در اینباند اصلی، مقدار `xver` را هم روی `1` یا `2` بگذارید. پنل این مقدار را خودکار پر نمی‌کند و همیشه `0` می‌گذارد. با `xver = 0`، اینباند اصلی هدر PROXY را برای مقصد نمی‌فرستد، ولی مقصد منتظر آن هدر است و اتصال برقرار نمی‌شود. این همان چیزی است که دیدید: با خاموش کردن Proxy Protocol مشکل برطرف می‌شود. **راه‌حل فعلی:** 1. اینباند اصلی (VLESS/Trojan روی پورت عمومی) را ویرایش کنید. 2. در کارت Fallbacks، برای هر ردیفی که اینباند مقصدش Proxy Protocol را فعال دارد، فیلد `xver` را روی `1` یا `2` بگذارید و ذخیره کنید. 3. برای ردیف‌هایی که مقصدشان Proxy Protocol ندارد، `xver` را روی `0` نگه دارید. نمی‌توانم تصویر پیوست را باز کنم. اگر با `xver` غیرصفر هم کار نکرد، لطفاً بخش `fallbacks` از کانفیگ Xray اینباند اصلی و `streamSettings` اینباند مقصد را به‌صورت متن (با حذف اطلاعات حساس) بفرستید. --- ``` Verdict: Confirmed bug Severity: Low Confidence: Medium Root cause: frontend/src/pages/inbounds/form/useInboundFallbacks.ts:104, deriveFallbackDefaults() hard-codes `return { name: sni, alpn, path, xver: 0 };` and never reads the child's acceptProxyProtocol. That contradicts the function's own comment (lines 79-80): "xver stays 0 unless the child explicitly opts in via PROXY-protocol sockopt." So a child with Proxy Protocol enabled is wired with xver 0: the master sends no PROXY header, and the child (expecting one) rejects the connection. Present since d1882c7f (refactor(frontend): reorganize source tree ... #4698). Same class: - frontend/src/pages/inbounds/form/useInboundFallbacks.ts:132 (updateFallback, auto-fill on child pick) - frontend/src/pages/inbounds/form/useInboundFallbacks.ts:174 (addAllFallbacks, `xver: derived.xver ?? 0`) - internal/web/service/fallback.go:149-150 BuildFallbacksJSON emits only the stored row's xver (`if r.Xver > 0 { entry["xver"] = r.Xver }`), so turning Proxy Protocol on for a child that is already wired never changes the fallback. Already fixed: Still present on the default branch (608ef4e4, v3.10.2) Duplicate of: None (#6313 is a Reality→XHTTP fallback that was fixed by a restart, a different cause) Evidence: - useInboundFallbacks.ts:104 `return { name: sni, alpn, path, xver: 0 };` - FallbacksCard.tsx:143-150 xver is a manual InputNumber (min 0, max 2) per row: the workaround - fallback.go:137-151 the generated fallback entry carries only dest/name/alpn/path/xver from the row Not determined: Whether the reporter's fallback rows actually had xver 0 (the screenshot is unreadable here). That Xray closes a connection without a PROXY header when acceptProxyProtocol is on is Xray-core behaviour (per its sockopt docs), not verified against Xray source in this checkout. The fallbacks block of the generated config.json would settle it. ``` Suggested fix: in `deriveFallbackDefaults`, read the child's `streamSettings.sockopt.acceptProxyProtocol` and the transport-level `acceptProxyProtocol` (`tcpSettings` / `wsSettings` / `httpupgradeSettings`), and return a non-zero `xver` when either is set, as the comment already says it should. That only covers rows auto-filled from now on. A fallback that is already wired and whose child turns Proxy Protocol on later would still be broken. A warning in the Fallbacks card when a row has `xver` 0 and its child accepts PROXY would cover that case too. _این پاسخ به‌صورت خودکار تولید شده است؛ ممکن است نگهدارنده‌ی پروژه پیگیری کند._ <!-- claude-issue:analyst -->
Author
Owner

@URT19 commented on GitHub (Oct 16, 2026):

Image

xver کجا تعیین میشه؟

الان من میخوام وب سوکت بسازم ، جایی وجود نداره برای انتخابش

<!-- gh-comment-id:6213358905 --> @URT19 commented on GitHub (Oct 16, 2026): <img width="777" height="618" alt="Image" src="https://github.com/user-attachments/assets/f1c55f44-8d13-40b5-9600-697f7ce5c86c" /> xver کجا تعیین میشه؟ الان من میخوام وب سوکت بسازم ، جایی وجود نداره برای انتخابش
Author
Owner

@mvanhorn commented on GitHub (Oct 20, 2026):

deriveFallbackDefaults always stored xver 0 and ignored acceptProxyProtocol on the child, both on sockopt and on the settings block for the network in use.

deriveFallbackDefaults now returns xver 1 when acceptProxyProtocol is boolean true on sockopt, or on the active transport block: tcpSettings for tcp and raw, wsSettings for ws, and httpupgradeSettings for httpupgrade.

https://github.com/MHSanaei/3x-ui/pull/6880

<!-- gh-comment-id:6286687131 --> @mvanhorn commented on GitHub (Oct 20, 2026): deriveFallbackDefaults always stored xver 0 and ignored acceptProxyProtocol on the child, both on sockopt and on the settings block for the network in use. deriveFallbackDefaults now returns xver 1 when acceptProxyProtocol is boolean true on sockopt, or on the active transport block: tcpSettings for tcp and raw, wsSettings for ws, and httpupgradeSettings for httpupgrade. https://github.com/MHSanaei/3x-ui/pull/6880
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#4547
No description provided.