mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[GH-ISSUE #6942] [Bug]: Panel does not support HTTP/2, returns 502 when Cloudflare HTTP/2 to Origin is enabled #4592
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#4592
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 @daohuosuo on GitHub (Oct 26, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6942
Describe the bug
hen using Cloudflare as a frontend proxy with
HTTP/2 to Originenabled (communication between Cloudflare and the origin server over HTTP/2), accessing the 3x-ui panel directly returns 502 Bad Gateway.How to reproduce the problem
127.0.0.1:2053, base path/3xui/domain/3xui/via browser → 502 error, panel fails to load, real-time log WebSocket handshake failsHTTP/2 to Origin→ Panel and WebSocket work normallyExpected behavior
No response
Actual behavior
No response
Relevant logs
Screenshots
No response
3x-ui version
3.11.0
Xray-core version
No response
How did you install 3x-ui?
Docker / Docker Compose
Operating system
Ubuntu 24.04
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?
None
Before submitting
@github-actions[bot] commented on GitHub (Oct 26, 2026):
The panel isn't part of the HTTP/2 connection in your setup, so I don't think the panel's HTTP/2 support is what causes this 502. Cloudflare's "HTTP/2 to Origin" setting controls the connection from Cloudflare to Nginx. Nginx then opens its own separate connection to
127.0.0.1:2053. To find out which of those two connections fails, I need the logs listed at the end.Why the panel's protocol doesn't matter here
proxy_passin Nginx talks to its upstream over HTTP/1.x only (proxy_http_versiontakes1.0or1.1). This is true whatever Cloudflare uses to reach Nginx. The panel only ever sees HTTP/1.1 from Nginx.internal/web/web.go:612-614): So it only negotiates HTTP/1.1. That only matters when Cloudflare connects straight to the panel port. In your setup Cloudflare connects to Nginx on 443.Please send these, as text:
nginxpage?error.log(often/var/log/nginx/error.log) from the moment you loaddomain/3xui/with HTTP/2 to Origin enabled.nginx -V) and the fullserver { listen 443 ... }block, with the domain redacted.127.0.0.1:2053is only reachable from Nginx if both share a network namespace (for examplenetwork_mode: host).Also, the form says "Is the panel behind a reverse proxy or CDN? → None", but your steps describe Cloudflare in front of Nginx. I've taken the steps as correct.
Verdict: Insufficient information
Severity: N/A
Confidence: Medium
Root cause: Not established. The panel only receives HTTP/1.x from Nginx's
proxy_pass. Its own TLS listener offers noh2ALPN (internal/web/web.go:612-614), but that hop isn't used in this setup. The failure most likely sits between Cloudflare and Nginx (inference).Same class: None found
Already fixed: Not applicable
Duplicate of: None
Evidence:
internal/web/web.go:612-614buildstls.Config{Certificates: ...}with noNextProtos, then wraps it withtls.NewListener(web.go:630) and serves vianetwork.ServeHTTP(web.go:649), so it negotiates HTTP/1.1 only. The panel's docs only cover proxying through Nginx/Caddy, with WebSocketUpgrade/Connectionheaders (docs/content/docs/en/operations/reverse-proxy.mdx:16-20).Not determined: Which connection returns the 502. The Nginx
error.loglines from a failing request, plus whether the 502 page is branded by Cloudflare or by nginx, would settle it.This reply was generated automatically; a maintainer may follow up.
@HamedSanaei commented on GitHub (Oct 27, 2026):
I checked the current
mainbranch and the project's Nginx reverse-proxy generator. There is not yet enough evidence to conclude this is a 3x-ui HTTP/2 bug.Findings
internal/web/web.go, the panel's own TLS listener does not explicitly advertiseh2via ALPN. That is relevant to direct TLS connections to the panel, but not necessarily to the deployment described here.proxy_pass http://127.0.0.1:2053andproxy_http_version 1.1. In your described topology, enabling Cloudflare's HTTP/2 to Origin affects Cloudflare → Nginx. Nginx makes a separate HTTP/1.1 request to Nginx → 3x-ui, so the panel itself does not need to support HTTP/2 for this setup.GET /3xui/would return 502.127.0.0.1inside an Nginx container refers to that container, not the 3x-ui container. However, that would ordinarily fail regardless of the Cloudflare toggle, so this is only something to verify, not a confirmed cause.Could you provide the following diagnostics?
GET /3xui/fail, or does the page load but only the live-log WebSocket fail? A screenshot or browser DevTools Network entries would help. Please include the timestamp and Cloudflare Ray ID if present.error.loglines (ideally also matchingaccess.loglines) for a failure with HTTP/2 to Origin enabled and a successful request with it disabled.nginx -V, a redacted version of the relevantserver { ... }andlocation /3xui/ { ... }blocks, the actualproxy_passtarget, and whether Nginx runs on the host or in a container (include its network mode).Please share the HTTP status and negotiated protocol from both outputs. If curl says HTTP/2 is unsupported, send
curl -V.5. Nginx → panel reachability: From the same network namespace as Nginx, test
curl -sv http://127.0.0.1:2053/3xui/ -o /dev/nullonly if your actualproxy_passuses that HTTP upstream; otherwise test your actual upstream target.Please redact any domain names, public IPs, credentials, tokens, cookies, and secrets before posting.
Next step: If the direct HTTP/2 request fails while HTTP/1.1 succeeds, we should investigate Nginx's HTTP/2/TLS behavior. If both direct requests succeed but the request through Cloudflare fails, focus on the Cloudflare ↔ Nginx hop. If Nginx logs consistently implicate the upstream panel, we can reproduce a 3x-ui defect and then propose a focused fix.
For now, I would avoid changing the panel's Go HTTP server or opening an HTTP/2 support PR without these results.