[PR #5503] [MERGED] fix(sockopt): honor trustedXForwardedFor on gRPC inbounds (xray v26.6.22) #5905

Closed
opened 2026-11-02 04:04:55 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/5503
Author: @rqzbeh
Created: 6/23/2026
Status: ✅ Merged
Merged: 6/23/2026
Merged by: @MHSanaei

Base: main ← Head: feat/grpc-trusted-xff-v26.6.22


📝 Commits (3)

  • 56dc9b5 fix(sockopt): honor trustedXForwardedFor on gRPC inbounds
  • d648938 Merge branch 'main' into feat/grpc-trusted-xff-v26.6.22
  • ab6615c docs(i18n): note gRPC in trustedXForwardedFor hint (all locales)

📊 Changes

14 files changed (+19 additions, -17 deletions)

View changed files

📝 frontend/src/pages/inbounds/form/transport/sockopt.tsx (+6 -4)
📝 internal/web/translation/ar-EG.json (+1 -1)
📝 internal/web/translation/en-US.json (+1 -1)
📝 internal/web/translation/es-ES.json (+1 -1)
📝 internal/web/translation/fa-IR.json (+1 -1)
📝 internal/web/translation/id-ID.json (+1 -1)
📝 internal/web/translation/ja-JP.json (+1 -1)
📝 internal/web/translation/pt-BR.json (+1 -1)
📝 internal/web/translation/ru-RU.json (+1 -1)
📝 internal/web/translation/tr-TR.json (+1 -1)
📝 internal/web/translation/uk-UA.json (+1 -1)
📝 internal/web/translation/vi-VN.json (+1 -1)
📝 internal/web/translation/zh-CN.json (+1 -1)
📝 internal/web/translation/zh-TW.json (+1 -1)

📄 Description

Summary

Make gRPC inbounds honor sockopt.trustedXForwardedFor in the panel, matching xray-core v26.6.22.

Why

xray-core v26.6.22 (commit 711aea4) switched the gRPC server from reading the x-real-ip gRPC metadata to resolving the client IP from X-Forwarded-For via sockopt.trustedXForwardedFor — the same mechanism already used by ws / httpupgrade / xhttp.

The panel already exposes the trustedXForwardedFor field, wire-normalizes it, and renders the input. Only the per-transport gate (TRUSTED_HEADER_NETWORKS in transport/sockopt.tsx) still omitted grpc. As a result, on a gRPC inbound the panel raised a false "this transport does not honor the header" warning and mis-flagged the Cloudflare real-client-IP preset, even though the generated config is valid and xray now honors it.

No Go dependency bump is needed: go.mod already pins an xray-core pseudo-version dated 2026-06-22, and 711aea4 landed 2026-06-18.

Type of change

  • Bug fix

Areas affected

  • Frontend (UI / panel pages)
  • Xray config generation

How was this tested?

  • Inbounds → add/edit a gRPC inbound → enable Sockopt → set Real client IP to Cloudflare (or add a header to Trusted X-Forwarded-For): the spurious transport-mismatch warning no longer appears, and the preset is no longer mis-flagged. The same on ws/httpupgrade/xhttp is unchanged.
  • go build ./... ✓, full Go test suite go test -shuffle=on -count=1 ✓.
  • Frontend typecheck ✓, lint ✓; test counts unchanged vs. base.

Screenshots / recordings

N/A — removes an erroneous warning; no new UI surface.

Breaking changes

None.

Checklist

  • I tested the change locally and confirmed the described behavior.
  • I added or updated tests for the new behavior (gate is a constant list; component gating is not unit-tested today).
  • go build ./... and the test suite pass locally.
  • For frontend changes: lint, typecheck, and build pass.
  • I updated the Wiki / README / API docs if user-facing behavior changed.
  • My commits follow the project's existing message style.
  • I have no unrelated changes mixed into this PR.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/5503 **Author:** [@rqzbeh](https://github.com/rqzbeh) **Created:** 6/23/2026 **Status:** ✅ Merged **Merged:** 6/23/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `feat/grpc-trusted-xff-v26.6.22` --- ### 📝 Commits (3) - [`56dc9b5`](https://github.com/MHSanaei/3x-ui/commit/56dc9b512e4e0af6d33322b077abc121a9efead1) fix(sockopt): honor trustedXForwardedFor on gRPC inbounds - [`d648938`](https://github.com/MHSanaei/3x-ui/commit/d648938611e68b825f25a48eca81b18c854ebd09) Merge branch 'main' into feat/grpc-trusted-xff-v26.6.22 - [`ab6615c`](https://github.com/MHSanaei/3x-ui/commit/ab6615c1ca346a81dc26310c3f7b080a0781ec96) docs(i18n): note gRPC in trustedXForwardedFor hint (all locales) ### 📊 Changes **14 files changed** (+19 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/pages/inbounds/form/transport/sockopt.tsx` (+6 -4) 📝 `internal/web/translation/ar-EG.json` (+1 -1) 📝 `internal/web/translation/en-US.json` (+1 -1) 📝 `internal/web/translation/es-ES.json` (+1 -1) 📝 `internal/web/translation/fa-IR.json` (+1 -1) 📝 `internal/web/translation/id-ID.json` (+1 -1) 📝 `internal/web/translation/ja-JP.json` (+1 -1) 📝 `internal/web/translation/pt-BR.json` (+1 -1) 📝 `internal/web/translation/ru-RU.json` (+1 -1) 📝 `internal/web/translation/tr-TR.json` (+1 -1) 📝 `internal/web/translation/uk-UA.json` (+1 -1) 📝 `internal/web/translation/vi-VN.json` (+1 -1) 📝 `internal/web/translation/zh-CN.json` (+1 -1) 📝 `internal/web/translation/zh-TW.json` (+1 -1) </details> ### 📄 Description ## Summary Make gRPC inbounds honor `sockopt.trustedXForwardedFor` in the panel, matching xray-core v26.6.22. ## Why xray-core v26.6.22 ([commit 711aea4](https://github.com/XTLS/Xray-core/commit/711aea4e34b0a00073d2fea6577f28a5d7c9b5eb)) switched the gRPC server from reading the `x-real-ip` gRPC metadata to resolving the client IP from `X-Forwarded-For` via `sockopt.trustedXForwardedFor` — the same mechanism already used by ws / httpupgrade / xhttp. The panel already exposes the `trustedXForwardedFor` field, wire-normalizes it, and renders the input. Only the per-transport gate (`TRUSTED_HEADER_NETWORKS` in `transport/sockopt.tsx`) still omitted `grpc`. As a result, on a gRPC inbound the panel raised a false "this transport does not honor the header" warning and mis-flagged the Cloudflare real-client-IP preset, even though the generated config is valid and xray now honors it. No Go dependency bump is needed: `go.mod` already pins an xray-core pseudo-version dated 2026-06-22, and 711aea4 landed 2026-06-18. ## Type of change - [x] Bug fix ## Areas affected - [x] Frontend (UI / panel pages) - [x] Xray config generation ## How was this tested? - Inbounds → add/edit a **gRPC** inbound → enable Sockopt → set **Real client IP** to *Cloudflare* (or add a header to *Trusted X-Forwarded-For*): the spurious transport-mismatch warning no longer appears, and the preset is no longer mis-flagged. The same on ws/httpupgrade/xhttp is unchanged. - `go build ./...` ✓, full Go test suite `go test -shuffle=on -count=1` ✓. - Frontend `typecheck` ✓, `lint` ✓; test counts unchanged vs. base. ## Screenshots / recordings N/A — removes an erroneous warning; no new UI surface. ## Breaking changes None. ## Checklist - [x] I tested the change locally and confirmed the described behavior. - [ ] I added or updated tests for the new behavior (gate is a constant list; component gating is not unit-tested today). - [x] `go build ./...` and the test suite pass locally. - [x] For frontend changes: lint, typecheck, and build pass. - [ ] I updated the Wiki / README / API docs if user-facing behavior changed. - [x] My commits follow the project's existing message style. - [x] I have no unrelated changes mixed into this PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:04:55 +07:00
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#5905
No description provided.