mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5481] [Bug]: x-ui setting -webCert/-webCertKey does not persist cert paths on a fresh install (panel stays HTTP-only) #3830
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#3830
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 @Taov-Russo on GitHub (Jun 22, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5481
Describe the bug
On a fresh 3x-ui v3.3.1 install, running
x-ui setting -webCert <fullchain> -webCertKey <privkey>exits successfully (no error, exit code 0) but does NOT write
webCertFile/webKeyFileto thesettingstable. As a result the panel keeps serving plain HTTP, andsetting -showstill printsWarning: Panel is not secure with SSL. Accessing the panel over HTTPS fails withERR_SSL_PROTOCOL_ERRORin the browser.The cert files themselves are valid and readable - manually inserting the same paths into the
settingstable makes the panel serve HTTPS correctly, which shows the issue is the CLI notpersisting the values, not the certificate.
How to reproduce the problem
Steps to reproduce the behavior:
/etc/x-ui/x-ui.db)./etc/taoru/ssl/fullchain.pem(0644) and/etc/taoru/ssl/privkey.pem(0600).Expected behavior
x-ui setting -webCert ... -webCertKey ...should persistwebCertFile/webKeyFileinto thesettingstable (inserting the rows if they do not exist yet), so that after a restart the panelserves HTTPS.
Actual behavior
Workaround
Inserting the rows directly works:
Suspected root cause
On a fresh DB the
webCertFile/webKeyFilerows do not exist in thesettingstable (onlywebPortandwebBasePathare seeded). Thesetting -webCert/-webCertKeypath appears to updateexisting rows only, so when the rows are absent nothing is written. After the rows are created
manually once, the CLI updates them fine - which is consistent with an UPDATE-only code path.
Relevant logs
Screenshots
No response
3x-ui version
v3.3.1
Xray-core version
No response
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 24.04 LTS (x86_64)
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?
No response
Before submitting
@github-actions[bot] commented on GitHub (Jun 22, 2026):
The root cause is confirmed by the source. The
-webCert/-webCertKeyflags are registered onsettingCmdinmain.go(lines 543–544), but thecase "setting":handler never callsupdateCert(). It only callsupdateSetting(), which handles port, username, password, webBasePath, listenIP, and resetTwoFactor — cert paths are not wired in.updateCert()is invoked exclusively by the separatecase "cert":branch (line 652 ofmain.go).Workaround (use this instead):
This is also the command used internally by
x-ui.sh's SSL Certificate Management menu (option 19), at lines 1377, 1401, 1634, and 1853 of that script.A secondary note on your suspected root cause:
saveSetting()ininternal/web/service/setting.go(lines 298–311) does a proper UPSERT — it inserts a new row when the key is absent and updates it otherwise. The "UPDATE-only" theory does not hold; onceupdateCert()is actually called, it works correctly on a fresh DB.The bug is that
x-ui setting -webCert/-webCertKeysilently accepts the flags but discards them. The fix would be to add aupdateCert(webCertFile, webKeyFile)call inside thecase "setting":block ofmain.gowhen either flag is non-empty, mirroring thecertsubcommand.This reply was generated automatically; a maintainer may follow up.