mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6135] [MERGED] fix(sub): honor trustedProxyCIDRs before forwarded URLs #6098
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6098
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/6135
Author: @PathGao
Created: 7/29/2026
Status: ✅ Merged
Merged: 7/29/2026
Merged by: @MHSanaei
Base:
main← Head:fix-sub-forwarded-header-trust-v2📝 Commits (3)
6b9a1fefix(sub): honor trustedProxyCIDRs before forwarded URLs419ab8efix(sub): avoid unused trust-setting lookups2672b22fix(frontend): meet config text contrast requirements📊 Changes
10 files changed (+325 additions, -12 deletions)
View changed files
📝
docs/content/docs/en/config/panel.mdx(+1 -1)📝
docs/content/docs/fa/config/panel.mdx(+1 -1)📝
docs/content/docs/ru/config/panel.mdx(+1 -1)📝
docs/content/docs/zh/config/panel.mdx(+1 -1)📝
frontend/src/components/clients/ConfigBlock.css(+4 -0)➕
internal/sub/forwarded_trust.go(+92 -0)➕
internal/sub/forwarded_trust_test.go(+205 -0)📝
internal/sub/service.go(+17 -6)📝
internal/web/controller/util.go(+1 -1)📝
internal/web/service/setting.go(+2 -1)📄 Description
Summary
Subscription URLs now honor an operator's customized
trustedProxyCIDRsbefore forwarded headers determine their host or scheme. This aligns the subscription server with the setting's intended boundary without changing existing deployments that have no stored value, an empty value, or the shipped default.The compatibility rule is deliberate: those untouched states retain the legacy forwarded-header behavior. Deployments that have declared a proxy boundary now receive the same protection for subscription links as they do for panel-generated links; rejected headers are diagnosable without permitting a polling client to flood warning logs.
Tests
X-Real-IPcannot bypass the forwarded-header gate.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.