mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5959] [Bug]: Web panel update resets custom short URL path back to default random string #4131
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#4131
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 @Ashteeer on GitHub (Jul 14, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5959
Describe the bug
When the panel is first installed, it generates a long, random URL path for security reasons. If a user manually changes this path to a custom, shorter, or more convenient one, updating the panel via the Web UI completely resets this setting back to a default/generated random string.
While I understand this might be intended as a security enforcement mechanism, it is inconvenient for users who consciously choose their own URL path and are aware of the risks. The custom path should not be overwritten during updates
How to reproduce the problem
Expected behavior
The panel should preserve the user-defined custom URL path during updates, even if it doesn't match the original randomly generated security string
Actual behavior
The custom URL path is forcibly reset, disrupting access and requiring manual reconfiguration
Relevant logs
Screenshots
No response
3x-ui version
3.5.0
Xray-core version
No response
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)
No response
Is the panel behind a reverse proxy or CDN?
Yes — other
Before submitting
@github-actions[bot] commented on GitHub (Jul 14, 2026):
Title:
update.sh'sconfig_after_update()regenerates any customwebBasePathof 3 characters or fewer on every updateSeverity: High
Category: Correctness
Why this matters:
Confirmed in source, including the exact release you're running. The Web UI's Update button calls
POST /server/updatePanel(internal/web/controller/server.go:71), which runsPanelService.StartUpdate()(internal/web/service/panel/panel.go:183). That function always downloads the latestupdate.shstraight from themainbranch (panelUpdaterURL,panel.go:43) and executes it — regardless of which version is installed.update_x-ui()then unconditionally callsconfig_after_update()(update.sh:1202), which reads the storedwebBasePath, strips its leading/, and regenerates it whenever the remainder is under 4 characters:The check is meant to catch the true factory default (a bare
/, which strips to an empty string) but a raw length threshold also matches any deliberately short custom path, e.g./a/,/ab/,/abc/. The panel's own validation allows these:webBasePath(frontend/src/schemas/setting.ts:5) only requires a leading slash, with no minimum length. I confirmed line 862 is identical, unchanged, in both currentmainand thev3.5.0tag you reported — and since every update re-downloadsupdate.shfrommain, this runs on every update of every installed version.This exact condition was previously diagnosed in #5179. The fix merged for that report only added a
systemctl restartafter regeneration so the new path takes effect immediately (fixing a login "desync" symptom); it did not correct the faulty-lt 4condition itself, which is why this is resurfacing.Recovering the new path is also harder than it looks. When
systemd-runis available, the update runs under a throwaway transient unit (x-ui-web-update-<timestamp>,panel.go:253), but the panel's "View Logs" feature (GetLogs,internal/web/service/server.go:1120) only readsjournalctl -u x-ui, so the newly generated path is never shown there. In the non-systemd-runfallback, the update process's stdout/stderr aren't captured at all. So an admin with a short custom path can be locked out of the web UI immediately after clicking Update, recoverable only via direct server/SSH access.Recommendation:
Replace the length heuristic with a check for the actual "unset" sentinel rather than a character count, e.g. (the leading slash is already stripped at this point, so an unset path is an empty string):
install.sh'sconfig_after_install()(line 1065) has the identical pattern and would need the same correction, since re-runninginstall.shover an existing database hits the same logic.If you'd rather work around this in the meantime: after any update, check
x-ui setting -show true(or the Settings page) for the currentwebBasePath, and restore it withx-ui setting -webBasePath "<yourpath>"followed bysystemctl restart x-uiif it was reset.Confidence: high — both the call path from the Web UI's Update button and the exact faulty condition are confirmed directly in the current source and in the
v3.5.0release tag.@MHSanaei for a decision on the fix approach.
This reply was generated automatically; a maintainer may follow up.
@MHSanaei commented on GitHub (Jul 14, 2026):
It should be more than 3 characters