mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #4798] [Bug]: Wrong ip in vless config #3334
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#3334
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 @gotyefrid on GitHub (Jun 2, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4798
Describe the bug
Continue #4750
I can confirm this issue is still present.
My setup:
network_mode: "host"Addressfield is explicitly set to my server's external VPS IP.The problem:
When generating client links/QR codes, the panel dynamically injects the local IP address of the device I am currently using to access the web UI (e.g., my phone's or laptop's IP) instead of using the VPS server's IP or the address configured in the inbound.
None of the workarounds (setting the Address in the inbound or changing panel settings) seem to fix this behavior.
How to reproduce the problem
Expected behavior
Actual behavior
ip is wrong
Relevant logs
Screenshots
No response
3x-ui version
3.2.6
Xray-core version
26.6.1
How did you install 3x-ui?
Docker / Docker Compose
Operating system
Ubuntu
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 (Jun 2, 2026):
Thanks for the detailed report and for confirming this is still present in v3.2.6.
Root cause
When generating client links/QR codes, the panel determines the server address from the incoming HTTP request via
resolveHost()(web/controller/inbound.go). The priority order is:X-Forwarded-Hostheader — if the request came from a trusted proxyX-Real-IPheader — fallback whenX-Forwarded-Hostis absent, but the request is still from a trusted proxyc.Request.Host— theHostheader the browser sent (the URL you typed)Behind Nginx (the common case from #4750)
A typical Nginx config sets:
Because the panel receives the request from
127.0.0.1(Nginx),127.0.0.1is in the default trusted-proxy list (127.0.0.1/32,::1/128). The panel then readsX-Real-IP, which Nginx has set to the client device's IP (your phone/laptop) — and that IP ends up in the generated link. This is the confirmed bug.Fix for Nginx setups: Add
X-Forwarded-Hostto your Nginx config so the panel uses the correct server hostname/IP instead of the client's IP:X-Forwarded-Hosttakes priority overX-Real-IPinresolveHost(), so once it is present and contains your panel's domain/IP, the correct value will be used for link generation.Direct Docker / no proxy
With
network_mode: "host"and no Nginx, the fallback path (c.Request.Host) is used — which is whatever hostname/IP your browser has in its URL bar. If you access the panel athttp://1.2.3.4:2053, the links should contain1.2.3.4.Could you confirm:
http://<VPS-IP>:<port>or a domain)?192.168.x.x) or something else?This will help confirm whether the no-proxy path also has a regression or if there is a configuration detail causing it.
Panel-settings override (partial workaround)
Panel Settings → Subscription → Listen Domain (
subDomain) is used as the host override, but currently only when the resolved request host is non-routable (loopback/unspecified). It does not override a private IP that leaks throughX-Real-IP, so this setting alone is not a reliable fix for the Nginx case — theX-Forwarded-Hostheader change above is necessary.@Ketty0725 commented on GitHub (Jun 2, 2026):
I also encountered the same issue. In versions 3.2.0 and earlier, after changing the Inbound settings address to the VPS's IP, the exported subscription displayed the correct IP. However, versions 3.2.5 and 3.2.6 broke this balance, and no matter how it was set, it couldn't be changed to the specified IP.
@DervilRus commented on GitHub (Jun 2, 2026):
I also encountered this issue in 3.2.6. I used to use a separate IP for each inbound, but now my subscription shows all inbounds with the domain I access, not the IP specified in each inbound.
@djbelous-coder commented on GitHub (Jun 2, 2026):
I have the same bug. But I am using SSH port forwarding to access to panel, so my address is http://127.0.0.1:22222/panel/ and of course in logs I see 127.0.0.1 and I have wrong client configs with "localhost" instead IP. I think Its happen begging v3.2.5
@MHSanaei commented on GitHub (Jun 2, 2026):
Fixed — this was a regression introduced in 3.2.5/3.2.6.
Root cause:
resolveInboundAddressstopped using the inbound's bind Listen/Address when generating subscription and share links, so it always advertised the host you reached the panel on (the request host /X-Real-IP) instead of the per-inbound IP. The panel QR path still honored Listen, which is why the panel and the exported subscription disagreed.Fix: The inbound's Listen is advertised again in subscription/share links when it is a routable address (a real IP or hostname). So setting an inbound's Address to your VPS IP — or a different IP per inbound — works as it did in ≤ 3.2.0.
Loopback (
127.0.0.1/::1), wildcard (0.0.0.0/::), and unix-socket binds still fall back to the subscriber host, so the earlier loopback-leak fix stays intact (a0.0.0.0inbound keeps using the host you connect on). External Proxy and node addresses keep their higher precedence.Verified end-to-end in Docker: an inbound with Listen
203.0.113.7now producesvless://…@203.0.113.7:…even when the panel is reached over127.0.0.1, while a0.0.0.0inbound still falls back to the request host.Will ship in the next release.
@MHSanaei commented on GitHub (Jun 2, 2026):
please test
https://github.com/MHSanaei/3x-ui/actions/runs/26844794568
@DervilRus commented on GitHub (Jun 9, 2026):
This has been fixed for subscriptions from single nodes. If you take a subscription to which all other nodes are connected, then instead of an IP, the domain through which the node is connected is again used.