mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5956] [Bug]: The existing TProxy configuration is not displayed correctly. #4128
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#4128
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?
Originally created by @Ramazik on GitHub (Jul 14, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5956
Describe the bug
The issue is identical to the one I described earlier in https://github.com/MHSanaei/3x-ui/issues/5621
This issue arose at the same time, but I didn't mention it because I assumed that the solution to the described issues would also include fixing this bug.
In an existing, previously created inbound configuration with the Sockopt option enabled, the TProxy field is displayed incorrectly—it's empty in the interface. Selecting a value and saving the inbound configuration does not correct the display issue.
How to reproduce the problem
Described above
Expected behavior
No response
Actual behavior
No response
Relevant logs
Screenshots
3x-ui version
3.5.0
Xray-core version
26.7.11
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 24.04
Which parts of the panel are affected?
Frontend (UI / panel pages)
Browser (only if it is a UI bug)
Chrome 150
Is the panel behind a reverse proxy or CDN?
No response
Before submitting
@github-actions[bot] commented on GitHub (Jul 14, 2026):
Confirmed as a real bug, distinct from #5621 but in the same family (the edit modal skipping schema-based defaulting when it loads a stored inbound into the form). Verified against both the reporter's v3.5.0 tag and the current
main(129f50d) — not yet fixed on either.Title:
sockopt.tproxyis left unpopulated when editing a stored inbound, and saving "Off" strips the key again, so the field can never display correctlySeverity: Medium
Category: Correctness
Why this matters:
When the edit modal opens an existing inbound,
InboundFormModal.tsx:359-360callsrawInboundToFormValues(dbInbound)directly on the raw DB row. Inside that function (frontend/src/lib/xray/inbound-form-adapter.ts:159-205),streamSettingsis copied through essentially unchanged — the only sub-object re-parsed through its Zod schema (to fill in defaults/migrate renamed keys) isxhttpSettings(lines 166-181, added by commit539bcc8specifically to fix #5621).sockoptgets no equivalent treatment.The TProxy control (
frontend/src/pages/inbounds/form/transport/sockopt.tsx:196-205) is aSelectbound straight tostreamSettings.sockopt.tproxyvia the sharedFormField(frontend/src/components/form/rhf/FormField.tsx:61-67), which forwardsfield.valueto thevalueprop with no fallback. So if the storedsockoptobject has notproxykey — true for any inbound whose sockopt config predates the TProxy UI (added when #5166 was fixed, 2026-06-11) — the Select renders with nothing selected, i.e. blank, exactly as shown in the screenshot. This only affects inbounds loaded from storage: a brand-new inbound toggling Sockopt on callsSockoptStreamSettingsSchema.parse({})(InboundFormModal.tsx:294), which always fillstproxy: 'off', so newly-created configs never hit this.This also explains why resaving doesn't help.
normalizeSockoptForWire()(frontend/src/lib/xray/stream-wire-normalize.ts:251) containsif (out.tproxy === 'off') delete out.tproxy;— "Off" is treated as the default and dropped from the payload before it's persisted. "Off" is the value most users would pick when they just want the blank field to show something sensible, but doing so strips the key again, reproducing the identical missing-key state on the next edit. Only picking "Redirect" or "TProxy" (a non-default value) actually survives a save and would redisplay correctly afterward.The same unguarded
FormFieldpattern is used for othersockoptsub-fields in that form (e.g.tcpcongestionatsockopt.tsx:188-195), so any older storedsockoptobject missing that key would show the same kind of blankSelect; TProxy is simply the field the reporter noticed. Runtime traffic handling is presumably unaffected either way, since the panel's own schema default for an absenttproxyis'off'(frontend/src/schemas/protocols/stream/sockopt.ts:56) — this looks like a pure display/round-trip defect, not a config-correctness one.Recommendation: In
rawInboundToFormValues, run the rawstreamSettings.sockoptobject throughSockoptStreamSettingsSchema.safeParse()(mirroring the existingxhttpSettingshandling atinbound-form-adapter.ts:170-180) before it reaches the form store, so missing keys are filled with their schema defaults on every load rather than only when a user manually toggles Sockopt on. No pull request has been opened; a maintainer can request an implementation by mentioning @claude.Example:
Confidence: high — traced end to end from the edit-open call site through the form binding to the save-time normalizer, and confirmed the same code exists in the v3.5.0 tag and current
main.@MHSanaei for awareness / triage.
This reply was generated automatically; a maintainer may follow up.
@Ramazik commented on GitHub (Jul 15, 2026):
Also (as seen in the screenshot), the Route Mark and TCP Keep Alive Interval fields display empty values when opening a previously saved configuration in which these fields were set to zero. I'm not sure if this is normal behavior.
@MHSanaei commented on GitHub (Jul 23, 2026):
Fixed in #6083. streamSettings.sockopt is now re-parsed through its schema on load, so TProxy (and other sockopt fields) display correctly for inbounds saved before the control existed.