mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5868] [Bug]: Blank page after login when using custom URI Path behind reverse proxy #4073
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#4073
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 @super-administrator on GitHub (Jul 9, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5868
Describe the bug
When accessing the 3X-UI panel through an Nginx reverse proxy with a domain name, the login page loads correctly and login succeeds, but after login the page becomes blank.
The issue only occurs when a custom
URI Pathis configured.If
URI Pathis empty or set to/, the panel works normally through the reverse proxy domain.If a custom
URI Pathis set, for example/z4s8rDfU2VdfQ5wUAI/, the login page can still be opened, but after successful login the panel UI becomes blank.Direct IP access works normally.
How to reproduce the problem
Listen Domainto the domain name inPanel Settings -> General.x-uicommand in the terminal and select9. Reset Settings.URI Pathto a custom value, for example/z4s8rDfU2VdfQ5wUAI/.Expected behavior
Expected behavior
After configuring Nginx as a reverse proxy, the 3X-UI panel should work normally when accessed through the reverse proxy domain.
Specifically:
Actual behavior
When 3X-UI v3.4.2 is placed behind Nginx reverse proxy, the login page loads correctly through the reverse proxy domain, but after successful login the page becomes blank.
The issue can be reproduced in two situations:
The reverse proxy itself appears to be working, because the login page can be loaded normally and login can be submitted. The problem seems to occur after login, likely when the frontend redirects, loads assets, or sends API requests under the configured domain/path.
The same Nginx reverse proxy configuration works correctly with v3.3.1. In that version, the panel can be accessed normally through the reverse proxy domain, including after login.
Relevant logs
The backend log only shows a normal service restart and successful login
Screenshots
3x-ui version
3.4.2
Xray-core version
v26.6.27
How did you install 3x-ui?
install.sh script
Operating system
CentOS 8
Which parts of the panel are affected?
No response
Browser (only if it is a UI bug)
chrome 149.0.7827.158
Is the panel behind a reverse proxy or CDN?
Nginx reverse proxy + Cloudflare CDN
Before submitting
@github-actions[bot] commented on GitHub (Jul 9, 2026):
I reviewed the base-path, session, and reverse-proxy-related code (
internal/web/web.go,internal/web/controller/dist.go,internal/web/middleware/domainValidator.go,frontend/vite.config.js,frontend/src/pages/settings/SettingsPage.tsx) but could not confirm a single line that produces a blank page after every login through the proxy with a customURI Path. The mechanism that's supposed to make a custom base path work looks host-agnostic:serveDistPage(internal/web/controller/dist.go:74-131) rewrites the entry HTML's assetsrc/hrefto the configured base path, and the ViterenderBuiltUrlhook (frontend/vite.config.js:149-158) resolves lazy-loaded page chunks againstwindow.X_UI_BASE_PATHat runtime rather than baking in a fixed prefix at build time. Neither depends onHost. Pinning down the actual cause needs your browser's console/network output (see the ask below).While tracing this, two other issues surfaced that match parts of your own reproduction steps and are worth flagging regardless of the main cause:
"Listen Domain" lockout (steps 5-6).
DomainValidatorMiddleware(internal/web/middleware/domainValidator.go:17-31) 403s any request unlessHost(minus port) is an exact, case-sensitive match for the storedwebDomain. Nothing normalizes that value: the backend getter (internal/web/service/setting.go:413-415) returns it raw, and the frontend schema (webDomain: z.string().optional(),frontend/src/schemas/setting.ts:9) has no format check — unlikewebBasePath, which is constrained toabsolutePath. A strayhttps://prefix, trailing/or space, or wrong case in "Listen Domain" makes every request fail that comparison, from the domain and from any IP alike, which matches "the panel can no longer be accessed through either IP address or domain name" until Reset Settings cleared it."Restart Panel" can drop you to
http://(step 10). The Settings page's "Restart Panel" button callsrebuildUrlAfterRestart()(frontend/src/pages/settings/SettingsPage.tsx:100-123). For a non-IP hostname (your case), it setsnewProtocol = (webCertFile || webKeyFile) ? 'https:' : 'http:'and forcesurl.protocol = newProtocolbefore navigating. A reverse-proxy setup normally leaves the panel's ownwebCertFile/webKeyFileempty since Nginx terminates TLS, so this evaluates tohttp:and can send the browser to a plain-HTTP URL Nginx isn't serving on that domain — which would look exactly like "loads, then goes blank/unreachable" right after a save-and-restart done from the panel UI.To isolate the core "blank after login" report, could you provide:
server/locationblock for the panel (redact the real domain) — the documented pattern is alocation <path>/ { proxy_pass http://127.0.0.1:<port>; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; ... }with no path segment after the port, so Nginx forwards the URI unchanged; a rewritten/stripped prefix is the most common cause of this exact symptom pattern.wss://<domain>/<uriPath>ws.journalctl -u x-ui -n 200, or the configuredXUI_LOG_FOLDER).x-uiCLI menu /systemctl restart x-ui— this determines whether finding 2 above is in play.@MHSanaei flagging findings 1 and 2 above for a decision either way — both look like real gaps in
internal/web/middleware/domainValidator.goandfrontend/src/pages/settings/SettingsPage.tsx, independent of whatever turns out to cause the main report.This reply was generated automatically; a maintainer may follow up.
@super-administrator commented on GitHub (Jul 9, 2026):
Thanks for the analysis. I retested the issue and narrowed it down further.
The problem does not seem to be caused by
URI Pathalone. With a custom URI Path such as/z4s8rDfU2VdfQ5wUAI/, direct IP access works normally. For example,https://<server-ip>:port/z4s8rDfU2VdfQ5wUAI/panel/settingsloads correctly, and the URI Path value is shown correctly in the panel settings.However, with the same custom URI Path, access through the Nginx reverse proxy domain becomes blank after login. The login page loads correctly at
https://<domain>/z4s8rDfU2VdfQ5wUAI/, and after login it redirects tohttps://<domain>/z4s8rDfU2VdfQ5wUAI/panel/, but the page is blank.So the current comparison is:
URI Path = /with the reverse proxy domain works normally; custom URI Path with direct IP access also works normally; but custom URI Path with the reverse proxy domain shows a blank page after login. The same Nginx reverse proxy configuration also works correctly withv3.3.1.Therefore, this issue seems limited to
v3.4.2 + Nginx reverse proxy domain + custom URI Path.From the browser Network tab, the main document and most JS/CSS assets return
200. The panel log also shows successful login, with no obvious backend error injournalctl -u x-ui -n 200. This suggests the login itself succeeds, and the issue may occur during frontend routing or rendering after login.One correction to my original report: I selected
Nonefor “Is the panel behind a reverse proxy or CDN?”, but the correct setup isNginx reverse proxy + Cloudflare CDN. TLS is handled by Nginx / Cloudflare, while the 3X-UI panel itself runs HTTP on the server.I will try to provide browser Console errors next, since Network mostly returns
200while the page still becomes blank.@super-administrator commented on GitHub (Jul 9, 2026):
Sorry, I accidentally closed this issue by mistake. I have reopened it.
Please ignore the accidental close action. The issue is still reproducible, and I have added more test results.
@super-administrator commented on GitHub (Jul 13, 2026):
Thank you for the quick fix and detailed explanation. I have tested it on v3.5.0, and the issue is resolved. The panel now works normally behind Cloudflare/Nginx reverse proxy with a custom URI path. Thanks again for your work.