[GH-ISSUE #5283] [Bug]: A white screen appears when using the Nginx proxy panel #3697

Closed
opened 2026-10-31 20:34:19 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @yuze66 on GitHub (Jun 13, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5283

Describe the bug

when I use nginx to visit my web, after login, I can not visit and white screen appears. I found these error, I am not sure that is a bug, may be it is my wrong setting

rocket-loader.min.js:1 Executing inline script violates the following Content Security Policy directive 'script-src 'self' 'nonce-9Ia+qwVxxxxxxh+ScZ6Q''. Either the 'unsafe-inline' keyword, a hash ('sha256-xxxxxxFwm/wlVb1Hf4xxxxxxxxxxiodkochw='), or a nonce ('nonce-...') is required to enable inline execution. The action has been blocked.
t.activateScript @ rocket-loader.min.js:1
vendor-router-Ba0IbRBU.js:1 is not able to match the URL "/fly/panel/" because it does not start with the basename, so the won't render anything.
_ @ vendor-router-Ba0IbRBU.js:1
userscript.html?name=%xxxxxxxxxxxxxxxxxB9.user.js&id=xxxxxx{"timestamp":xxxxxxxxxxx,"code":0,"message":"请求成功","result":[{"url":"https://cdn.lyck6.cn/adimg/1.png","hash":"dac9bexxxxxxxxxxx7613ec1fa50"},{"click":"https://www.itihey.com","url":"https://cdn.lyck6.cn/adimg/3.png","hash":"2bcca95axxxxxxxxxxx5ef497172d"}]}

How to reproduce the problem

set my web base path /fly/
visit https://xxxxxx.com/fly
after login, white screen appears

Expected behavior

No response

Actual behavior

No response

Relevant logs


Screenshots

No response

3x-ui version

3.3.1

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?

No response

Browser (only if it is a UI bug)

Microsoft edge

Is the panel behind a reverse proxy or CDN?

Yes — Nginx

Before submitting

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
Originally created by @yuze66 on GitHub (Jun 13, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5283 ### Describe the bug when I use nginx to visit my web, after login, I can not visit and white screen appears. I found these error, I am not sure that is a bug, may be it is my wrong setting rocket-loader.min.js:1 Executing inline script violates the following Content Security Policy directive 'script-src 'self' 'nonce-9Ia+qwVxxxxxxh+ScZ6Q''. Either the 'unsafe-inline' keyword, a hash ('sha256-xxxxxxFwm/wlVb1Hf4xxxxxxxxxxiodkochw='), or a nonce ('nonce-...') is required to enable inline execution. The action has been blocked. t.activateScript @ rocket-loader.min.js:1 vendor-router-Ba0IbRBU.js:1 <Router basename="/panel"> is not able to match the URL "/fly/panel/" because it does not start with the basename, so the <Router> won't render anything. _ @ vendor-router-Ba0IbRBU.js:1 userscript.html?name=%xxxxxxxxxxxxxxxxxB9.user.js&id=xxxxxx{"timestamp":xxxxxxxxxxx,"code":0,"message":"请求成功","result":[{"url":"https://cdn.lyck6.cn/adimg/1.png","hash":"dac9bexxxxxxxxxxx7613ec1fa50"},{"click":"https://www.itihey.com","url":"https://cdn.lyck6.cn/adimg/3.png","hash":"2bcca95axxxxxxxxxxx5ef497172d"}]} ### How to reproduce the problem set my web base path /fly/ visit https://xxxxxx.com/fly after login, white screen appears ### Expected behavior _No response_ ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.3.1 ### 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? _No response_ ### Browser (only if it is a UI bug) Microsoft edge ### Is the panel behind a reverse proxy or CDN? Yes — Nginx ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:34:19 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@github-actions[bot] commented on GitHub (Jun 13, 2026):

The white screen is caused by Cloudflare Rocket Loader, not by your Nginx configuration. The browser console error rocket-loader.min.js:1 Executing inline script violates the following Content Security Policy directive is the direct indicator.

What happens:

The panel backend (internal/web/middleware/security.go) generates a per-request CSP nonce and sends it in the Content-Security-Policy response header:

script-src 'self' 'nonce-<random>';

It then injects a small inline bootstrap script into the served HTML (internal/web/controller/dist.go, line 113):

<script nonce="<same-random>">window.X_UI_BASE_PATH="/fly/"; ...</script>

Cloudflare Rocket Loader intercepts all <script> tags to defer their execution, but it strips the nonce attribute in the process. When it tries to re-execute the script, the browser's CSP rejects it — the nonce no longer matches — so the script never runs.

Because window.X_UI_BASE_PATH is never set, the React Router falls back to its default and initializes with basename="/panel" (frontend/src/routes.tsx, line 37-39). The browser URL is /fly/panel/, which does not start with /panel, so the Router renders nothing — producing the blank screen you see.

Fix — disable Cloudflare Rocket Loader:

In the Cloudflare dashboard for your domain, go to Speed → Optimization → Content Optimization → Rocket Loader and turn it off. If you prefer a targeted rule, create a Page Rule matching yourdomain.com/fly/* with the action "Rocket Loader: Off".

After disabling it, the inline script will execute correctly, window.X_UI_BASE_PATH will be set to /fly/, and the Router will compute basename="/fly/panel" which matches the URL.

Nginx sub-path proxy (verify your config is correct):

If you also want to confirm the Nginx side is correct, the location block for a sub-path reverse proxy must pass the prefix to the upstream. A working pattern:

location /fly/ {
    proxy_pass http://127.0.0.1:<panel_port>/fly/;
    proxy_http_version 1.1;
    proxy_set_header Host              $host;
    proxy_set_header X-Real-IP         $remote_addr;
    proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
    proxy_set_header Upgrade           $http_upgrade;
    proxy_set_header Connection        "upgrade";
}

The trailing slash on both location /fly/ and proxy_pass .../fly/ is required so Nginx does not strip the prefix before forwarding.

The third block in your error log (the userscript.html JSON output with ad image URLs) is from a browser extension and is unrelated to this issue.


This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:4698896024 --> @github-actions[bot] commented on GitHub (Jun 13, 2026): The white screen is caused by **Cloudflare Rocket Loader**, not by your Nginx configuration. The browser console error `rocket-loader.min.js:1 Executing inline script violates the following Content Security Policy directive` is the direct indicator. **What happens:** The panel backend (`internal/web/middleware/security.go`) generates a per-request CSP nonce and sends it in the `Content-Security-Policy` response header: ``` script-src 'self' 'nonce-<random>'; ``` It then injects a small inline bootstrap script into the served HTML (`internal/web/controller/dist.go`, line 113): ```html <script nonce="<same-random>">window.X_UI_BASE_PATH="/fly/"; ...</script> ``` Cloudflare Rocket Loader intercepts all `<script>` tags to defer their execution, but it strips the `nonce` attribute in the process. When it tries to re-execute the script, the browser's CSP rejects it — the nonce no longer matches — so the script never runs. Because `window.X_UI_BASE_PATH` is never set, the React Router falls back to its default and initializes with `basename="/panel"` (`frontend/src/routes.tsx`, line 37-39). The browser URL is `/fly/panel/`, which does not start with `/panel`, so the Router renders nothing — producing the blank screen you see. **Fix — disable Cloudflare Rocket Loader:** In the Cloudflare dashboard for your domain, go to **Speed → Optimization → Content Optimization → Rocket Loader** and turn it off. If you prefer a targeted rule, create a Page Rule matching `yourdomain.com/fly/*` with the action "Rocket Loader: Off". After disabling it, the inline script will execute correctly, `window.X_UI_BASE_PATH` will be set to `/fly/`, and the Router will compute `basename="/fly/panel"` which matches the URL. **Nginx sub-path proxy (verify your config is correct):** If you also want to confirm the Nginx side is correct, the `location` block for a sub-path reverse proxy must pass the prefix to the upstream. A working pattern: ```nginx location /fly/ { proxy_pass http://127.0.0.1:<panel_port>/fly/; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } ``` The trailing slash on both `location /fly/` and `proxy_pass .../fly/` is required so Nginx does not strip the prefix before forwarding. **The third block in your error log** (the `userscript.html` JSON output with ad image URLs) is from a browser extension and is unrelated to this issue. --- *This reply was generated automatically; a maintainer may follow up.*
Author
Owner

@yuze66 commented on GitHub (Jun 13, 2026):

the bug has disapper when I turn off Rocket Loader, thanks. but do you have better way handle it

<!-- gh-comment-id:4698965335 --> @yuze66 commented on GitHub (Jun 13, 2026): the bug has disapper when I turn off Rocket Loader, thanks. but do you have better way handle it
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#3697
No description provided.