mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5419] [Bug]: WebBasePath conflicts with hardcoded frontend basename "/panel" causing blank panel page via Cloudflare Tunnel #3789
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#3789
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 @freemankevin on GitHub (Jun 17, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5419
Describe the bug
Problem Description
When accessing the 3x-ui panel through Cloudflare Tunnel, the login page loads successfully, but the panel itself shows a blank white screen. The browser console shows the following error:
Root Cause
The frontend code hardcodes the
/panelpath, while the backendWebBasePathis dynamically generated (either a random string like/z2YGbXMdFnZvmUfdx8or user-defined like/panel). When these two don't match exactly, React Router fails to match the route and renders nothing.Hardcoded Locations Found
routes.tsx:43-computeBasename()function returns${trimmed}/panelvite.config.js:136- Route rewrite rules checkstripped === 'panel'/panel/api/...paths (20+ locations)Steps to Reproduce
/panelor let it generate a random string)https://your-domain.com/your-WebBasePath/Expected Behavior
The frontend
basenameshould dynamically read fromwindow.X_UI_BASE_PATHor the backend configuration, instead of being hardcoded to/panel.Environment
Current Workaround
None available without modifying source code and recompiling, or downgrading to an older version.
Additional Context
This issue affects all users who:
/panelto anything elseThe hardcoded
/panelin the frontend makes theWebBasePathsetting essentially broken for any non-default value.How to reproduce the problem
/panelor let it generate a random string)https://your-domain.com/your-WebBasePath/Expected behavior
No response
Actual behavior
No response
Relevant logs
Screenshots
No response
3x-ui version
3.1.1
Xray-core version
26.1
How did you install 3x-ui?
install.sh script
Operating system
Debian 12
Which parts of the panel are affected?
Frontend (UI / panel pages)
Browser (only if it is a UI bug)
Google Chrome Version 149.0.7827.156 (Official Build) (64-bit)
Is the panel behind a reverse proxy or CDN?
None
Before submitting
@github-actions[bot] commented on GitHub (Jun 17, 2026):
This is a duplicate of #5283 (and the subsequently closed #5391), which document the same root cause and confirmed fix.
The reporter's framing — that the frontend hardcodes
/panel— is a misdiagnosis.computeBasename()infrontend/src/routes.tsx(lines 38-42) does readwindow.X_UI_BASE_PATHdynamically. The backend correctly injects the right value into every served HTML page at runtime (internal/web/controller/dist.go, lines 112-119). The injection is being blocked before it executes.Actual root cause: Cloudflare Rocket Loader breaks the CSP nonce
internal/web/middleware/security.go(line 21) generates a fresh random nonce per request and places it in theContent-Security-Policyheader:script-src 'self' 'nonce-<random>'.internal/web/controller/dist.go(line 113) injects a small inline script into the served HTML with that same nonce, settingwindow.X_UI_BASE_PATH.nonceattribute in the process. The browser then rejects the re-execution because the nonce no longer matches the CSP header. This is therocket-loader.min.js: Executing inline script violates the following Content Security Policy directiveerror that appears in the browser console in all three reports.window.X_UI_BASE_PATHis never set.computeBasename()falls back to'/'(routes.tsx line 39,|| '/'), producingbasename="/panel". The browser URL is/your-base-path/panel/, which does not start with/panel, so React Router renders nothing — blank screen.Fix
Disable Cloudflare Rocket Loader for your domain in the Cloudflare dashboard: Speed > Optimization > Content Optimization > Rocket Loader — toggle off. To limit the scope, create a Page Rule matching
yourdomain.com/*with the action Rocket Loader: Off.This was the confirmed fix for #5283 (same version, same console errors).
This reply was generated automatically; a maintainer may follow up.