mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5304] [Bug]: Default xray API inbound port may conflict with user-created inbound port #3717
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#3717
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 @m0nstrum on GitHub (Jun 14, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5304
Describe the bug
3x-ui creates a default API inbound using the 62789 port. It is possible to create an inbound using the same port without any warning. Xray then listens on the same port with two different inbounds, causing requests to be distributed between them unpredictably.
How to reproduce the problem
Install 3x-ui with default settings.
Create an inbound using 62789 port
Try to connect with xray client/curl/etc
Expected behavior
3x-ui should prevent port conflicts or display a warning when another inbound already uses the selected port. This already happens with inbounds added by users, but not with the default inbound
Actual behavior
Two inbounds listen on the same port. Some requests are handled by the user's inbound and others by the API tunnel inbound, causing intermittent failures.
Relevant logs
Screenshots
No response
3x-ui version
3.3.1
Xray-core version
26.6.1
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 24.04
Which parts of the panel are affected?
Frontend (UI / panel pages), Xray config generation
Browser (only if it is a UI bug)
No response
Is the panel behind a reverse proxy or CDN?
Yes — Nginx
Before submitting
@github-actions[bot] commented on GitHub (Jun 14, 2026):
The bug is confirmed and the root cause is clear.
Root cause
The port-conflict check (
checkPortConflictininternal/web/service/port_conflict.go:129) only queries theinboundsdatabase table. The API inbound is not in that table — it is defined in the embedded Xray config template (internal/web/service/config.json, port 62789,listen: "127.0.0.1") and injected at runtime byGetXrayConfig()ininternal/web/service/xray.go:107. Because the conflict check never sees the API inbound,AddInbound(line 573) andUpdateInbound(line 934 ofinbound.go) both pass validation for port 62789 without any warning.At Xray start, the resulting merged config contains two inbounds on port 62789:
127.0.0.1:62789(from the template).*:62789(from the database).This matches exactly what
ss -lntpshows in the report.Additional detail
The API port is not hardcoded to 62789 at the conflict-check layer — users can edit the Xray config template via the panel settings, changing the API inbound's port. Any fix therefore needs to read the current template and extract the actual API inbound port at validation time, rather than hardcoding 62789.
Workaround (until fixed)
Do not use port 62789 (or whichever port is configured for the
"api"tag inbound in your Xray config template) for user-created inbounds. You can check the active API port by looking at theinboundssection of your Xray config template in the panel settings under Xray Settings → Xray Configuration.No additional information is needed to reproduce or fix this issue.
This reply was generated automatically; a maintainer may follow up.
@MHSanaei commented on GitHub (Jun 15, 2026):
Fixed on
mainin0d87bb8b. Creating a local inbound on the reserved Xray API port (default62789) is now reported as a port conflict instead of silently letting Xray bind the port twice. Nodes are unaffected (they run their own Xray). Ships in the next release.