mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5251] [Feature]: Allow overriding the port in addition to the address under the 'Share address strategy' option #3678
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#3678
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 @ex-lain on GitHub (Jun 13, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5251
Is your feature request related to a problem?
I use Nginx on port 443 as a reverse proxy to route traffic to multiple inbounds for different protocols. Since the inbounds use different local ports, the generated sub/export links end up with the wrong ports.
Describe the solution you'd like
I'd be very grateful if we could override the port as well as the address in the subscription/export settings. Another option would be supporting multiple inbounds on a single port in 3x-ui, but I assume that's more difficult to implement.
Alternatives you've considered
No response
Concrete use case
No response
Mockups, screenshots, or examples
No response
Which parts of the panel would this affect?
Subscription (share links / Clash / JSON)
Are you willing to help?
Before submitting
@github-actions[bot] commented on GitHub (Jun 13, 2026):
The current "Share address strategy" feature (confirmed in
internal/database/model/model.goandinternal/web/service/inbound.go) supports three modes —node,listen, andcustom— for overriding the host/address in subscription links, but there is no corresponding field to override the port. In every protocol link generator ininternal/sub/service.go(lines 427, 513, 571, 674, 790, etc.) the port is always taken directly frominbound.Portwithout any override path. So the gap you have identified is real and not currently supported via the share address strategy.Existing partial workaround — External Proxies
There is an existing mechanism that does support both host and port override: the External Proxy entries in an inbound's stream settings. Each external proxy entry has a
dest(host) andportfield; when one or more entries are configured, the subscription service generates a separate share link per entry (using those host/port values) rather than the inbound's own listen address and port. This is implemented ininternal/sub/service.go:buildExternalProxyURLLinks(line 1472) and is called for VMess, VLESS, Trojan, Shadowsocks, and Hysteria2.The trade-off with external proxies is that they generate additional links alongside (or instead of) the primary inbound link, and they carry extra TLS/SNI parameters intended for CDN fronting scenarios. For a straightforward Nginx-on-443 reverse proxy case — where you simply want the single generated link to advertise port 443 instead of the inbound's local port — this is more complex than needed, and it may not produce the clean output you want for all client types.
What this feature request would add
A
sharePortfield (analogous toshareAddr) on the inbound record, respected by the three existing strategy modes, would be the natural extension. A PR implementing this would need to touch:internal/database/model/model.go— add the field and a migrationinternal/web/service/inbound.go— validate/normalize the valueinternal/sub/service.go— introduce aresolveInboundPorthelper (parallel toresolveInboundAddress) and wire it into each protocol link generatorfrontend/src/— expose the field in the inbound settings formThis reply was generated automatically; a maintainer may follow up.
@MHSanaei commented on GitHub (Jul 3, 2026):
Since this issue was opened, the panel gained a Hosts feature (PR #5409) that covers this exact use case. Open the Hosts page from the panel sidebar and add a host entry for each inbound behind your reverse proxy: leave the address blank to inherit the inbound's share address, and set the port to 443 (a port of 0 inherits the inbound's own port).
When an inbound has host entries, the subscription output (raw, JSON, and Clash) emits links using the host's address and port instead of the inbound's local listen port — and hosts also support per-entry SNI, path, and host-header overrides for reverse-proxy setups.
Closing as available in the current release — please comment if your scenario still isn't covered.