mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5534] Question: How should Share address strategy, Hosts, and externalProxy work together? #3863
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#3863
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 @atem32 on GitHub (Jun 24, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5534
What are you trying to do?
I am trying to understand how the new
Share address strategysetting is supposed to work and how it relates to the oldexternalProxybehavior.In previous versions,
externalProxywas used to define the address that should be written into exported share links, QR codes, and subscription output when the panel was behind a router / reverse proxy / NAT.In the current UI, there is a new setting here:
The description says:
By default, it is set to:
This looks like it may be a replacement for the old
externalProxysetting.However, even when
Share address strategyis set toInbound listen, the config still contains:When I change
Share address strategytoCustomand set a custom address, I do not see any change in theexternalProxyconfig.So I am not sure what the expected relationship is between these settings.
Is
Share address strategysupposed to replaceexternalProxy, or is it a separate setting?Should changing
Share address strategytoCustomupdateexternalProxy, or is the custom address stored somewhere else?Also, there is now a
Hoststab, and it is not clear what it is intended for.The content of the
Hoststab looks like it corresponds to the existingexternalProxyconfig. At least visually, it seems to contain the same type of data asexternalProxy.So I would like to clarify the intended model:
Are these three parts connected?
If yes, what is the expected workflow for a panel behind a router / reverse proxy where exported share links, QR codes, and subscriptions should use a public external address instead of the inbound listen address?
For example, if the inbound listens locally or behind NAT, but users should connect to:
where should this address be configured now?
Should it be configured in:
or:
or:
or some combination of them?
The current UI is confusing because
Share address strategysounds like the setting that controls exported share links, but changing it toCustomdoes not appear to update the visibleexternalProxyconfig.At the same time, the
Hoststab looks like it may be the new UI forexternalProxy, but this is not obvious from the UI.What have you already tried?
No response
3x-ui version
3.4.0
How did you install 3x-ui?
install.sh script
Operating system
Debian 12
Screenshots or config snippets
No response
Before submitting
@github-actions[bot] commented on GitHub (Jun 24, 2026):
These three mechanisms are related but serve distinct roles. Here is what the source code confirms.
1.
externalProxy(legacy)externalProxyis an array stored inside an inbound'sstreamSettingsJSON blob. In older versions it was the only way to tell the subscription engine to advertise a different address/port/TLS to connecting clients. The field is still parsed by the subscription service (internal/sub/service.go) and still works — but only when no Hosts are defined for that inbound (see point 2). The field is no longer editable in the inbound editor; a comment infrontend/src/pages/inbounds/form/InboundFormModal.tsx(line 806) reads: "The legacy externalProxy section is replaced by the Hosts page; the field is still parsed/rendered for backward compatibility but is no longer editable here."2. Hosts (the replacement for
externalProxy)The Hosts page (
frontend/src/pages/hosts/) manages rows in a separatehostsdatabase table. Each row belongs to a specific inbound and defines one external endpoint — address, port, TLS/security, SNI, fingerprint, path, etc.When the subscription service builds links for an inbound, it first calls
hostEndpoints()(internal/sub/host_sub.go:19). If any enabled Hosts exist for that inbound, the service uses those exclusively and theexternalProxyarray instreamSettingsis bypassed entirely:The
hostToExternalProxyMap()function (internal/sub/host_sub.go:45) translates each Host into an externalProxy-shaped map that the existing per-format renderers consume. One share link is generated per enabled Host per client.Why you still see
externalProxyin the JSON after upgrading: The database migration (seedHostsFromExternalProxyininternal/database/db.go:164) was intentionally additive. It read every inbound'sstreamSettings, created a Host row for eachexternalProxyentry, and left the originalexternalProxyarray untouched. The two now coexist in storage, but at runtime only the Hosts table entries are used (becausehostEndpoints()returns non-nil and short-circuits the legacy path).3. Share address strategy (
shareAddrStrategy)This is a column on the
inboundstable (internal/database/model/model.go:69-70). It controls the address resolved byresolveInboundAddress()(internal/sub/service.go:939) — this is the base/fallback address used when:Addressfield (a "relative" host that inherits the inbound's address but overrides other settings).Changing
shareAddrStrategytocustomdoes not modifyexternalProxybecause they are independent mechanisms.shareAddrStrategyis a lightweight override on the inbound row itself;externalProxyis part of the raw stream JSON.Recommended workflow for NAT / reverse-proxy (inbound on LAN, users connect to
example.com:443)There are two approaches:
A — Single endpoint, no CDN (simplest): If clients connect to exactly one address, set
Share address strategytoCustomandShare addrtoexample.comon the inbound. The subscription service will useexample.comas the host in every generated link, combined with the inbound's configured port.B — One or more external endpoints (Hosts approach, recommended for multi-CDN or when you want per-endpoint TLS/SNI control): Go to the Hosts page, create a Host for the inbound with
Address = example.com,Port = 443, and the appropriateSecurity/SNIvalues. Each enabled Host generates one share link per client. You can create multiple Hosts for the same inbound to produce multiple links (CDN, clean-IP, direct, etc.).If you already have
externalProxyentries that were migrated, the corresponding Host rows were created automatically during upgrade. You can manage them from the Hosts page. The staleexternalProxyarray remaining in the JSON has no effect on link generation as long as at least one enabled Host exists for that inbound.This reply was generated automatically; a maintainer may follow up.