[GH-ISSUE #4776] [Feature]: Add a way to group multiple routing identities into one subscription #3313

Closed
opened 2026-10-31 20:31:34 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @chuck852 on GitHub (Jun 1, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4776

Add a title

[Feature]: Support multi-link subscriptions with separate routing identities


Yes.

This is not a duplicate of #4759 or #4775.

Those issues describe the visible symptom: duplicate subId is no longer allowed after v3.2.5. This feature request is about the missing replacement design for a previously possible advanced routing use case.

Before v3.2.5, it was possible to create several different clients with the same subscription ID:

client-a / email=route-a / subId=user1 / inbound=vless-tcp-raw-443 -> routing by user=route-a -> outboundTag=chain-a
client-b / email=route-b / subId=user1 / inbound=vless-tcp-raw-443 -> routing by user=route-b -> outboundTag=chain-b
client-c / email=route-c / subId=user1 / inbound=vless-tcp-raw-443 -> routing by user=route-c -> outboundTag=chain-c

This allowed one end user to have one subscription URL:

/sub/user1

while the subscription contained several connection options. Each option had a different Xray user/email, so Xray routing could send each option to a different outboundTag.

This is useful for cascade routing:

Client -> Main server :443 -> outbound chain A -> Internet
Client -> Main server :443 -> outbound chain B -> Internet
Client -> Main server :443 -> outbound chain C -> Internet

After v3.2.5, this model is no longer possible because multiple clients cannot share the same subId.

The new “attach existing client to multiple inbounds” model does not fully replace this use case. It changes the routing discriminator from user/email to inboundTag. That means a separate inbound is required for each routing option.

For single-port setups like VLESS TCP RAW on port 443, this is not a practical replacement. It is not possible to create several equivalent VLESS TCP RAW inbounds on the same IP and port only to separate routing paths.

The core problem is that these three concepts are now coupled too tightly:

subscription grouping == client identity == routing identity

For advanced routing, they need to be separable:

subscription grouping != client identity != routing identity

Describe the solution you'd like

I would like the panel to provide a supported way to create one subscription that contains multiple generated connection options, where each option can still have a separate routing identity.

The required behavior is:

one subscription URL
multiple generated links
same inbound/IP/port possible
different routing identities
different outboundTags

Possible design 1: add a non-unique subscription grouping field

Introduce a new field, for example:

subscriptionGroup

or:

subscriptionId

This field would be used only to group several clients into one subscription.

Then the model could be:

email/user = unique, used for Xray routing
client ID / internal ID = unique, used for client identity
subscriptionGroup = non-unique, used to group several clients into one subscription

Example:

client email=route-a / subscriptionGroup=user1 -> outboundTag=chain-a
client email=route-b / subscriptionGroup=user1 -> outboundTag=chain-b
client email=route-c / subscriptionGroup=user1 -> outboundTag=chain-c

The subscription endpoint could then be:

/sub/user1

and it would include all clients with:

subscriptionGroup=user1

This keeps client identity unique while restoring multi-link subscriptions.

Possible UI placement:

  • On the client edit/create modal:

    • keep email unique
    • keep current subId behavior if needed
    • add an optional Subscription group field
  • On the Clients page:

    • allow filtering/grouping by Subscription group
  • On the Subscription page/API:

    • generate the subscription by subscriptionGroup when it is set
    • preserve the current behavior for users who do not use this advanced field

Possible design 2: add per-connection routing identity

Another option is to introduce a per-generated-link routing identity.

For example, each generated connection option inside a subscription could have:

routeId
routeEmail
connectionIdentity

Example:

Subscription owner: user1

Connection profile A:
  display name: user1 - chain A
  routing identity: user1-chain-a
  outboundTag: chain-a

Connection profile B:
  display name: user1 - chain B
  routing identity: user1-chain-b
  outboundTag: chain-b

The important part is that the generated Xray configuration must expose a stable discriminator that can be used by routing rules.

Possible design 3: advanced subscription profiles

Add an advanced mode where a subscription can contain several profiles:

Subscription: user1

Profile A:
  inbound: vless-tcp-raw-443
  routing user/email: route-a
  outboundTag: chain-a

Profile B:
  inbound: vless-tcp-raw-443
  routing user/email: route-b
  outboundTag: chain-b

This would allow one subscription to contain multiple server-side route profiles without requiring multiple inbounds on the same port.

I am not asking to simply revert all v3.2.5 changes. I am asking for an explicit replacement design for the routing scenario that was possible before v3.2.5.

Alternatives you've considered

  1. Use “attach existing client to multiple inbounds”

This does not fully solve the problem because routing then has to distinguish links by inboundTag.

For my scenario, all connection options need to use the same public endpoint:

same IP
same port 443
same VLESS TCP RAW inbound

I cannot create multiple equivalent TCP RAW inbounds on the same IP and port.

  1. Create one inbound per cascade route

This is not practical for single-port deployments. For example, VLESS TCP RAW on port 443 cannot be duplicated multiple times on the same IP and port.

  1. Use different subId values

This breaks the user experience because the end user no longer has one subscription URL. Instead, I would have to give them several subscription URLs:

/sub/user1-chain-a
/sub/user1-chain-b
/sub/user1-chain-c

The previous working behavior allowed one subscription URL with several connection options.

  1. Use an external subscription aggregator

This can work as a workaround, but it moves subscription logic outside 3x-ui. It also makes management, traffic accounting, link naming, and user lifecycle less consistent.

  1. Roll back to v3.2.0

This is not a good long-term solution because v3.2.5 contains other fixes and improvements. The goal is to support the advanced routing use case in the current model, not to stay on an older version forever.

  1. Use VLESS vlessRoute

This is not a general solution. It is specific to VLESS and does not cover other protocols. It is also not exposed in 3x-ui as a normal subscription/profile management feature for this use case.

Concrete use case

I use 3x-ui for cascade routing.

A single end user should receive one subscription URL, but inside that subscription they should have several connection options. Each option goes through the same public inbound endpoint but should be routed to a different outbound chain.

Example:

Public inbound:
  protocol: VLESS
  transport: TCP RAW
  port: 443

Subscription:
  /sub/user1

Generated links inside this subscription:
  user1 - chain A
  user1 - chain B
  user1 - chain C

Server-side routing:

routing user/email = user1-chain-a -> outboundTag = chain-a
routing user/email = user1-chain-b -> outboundTag = chain-b
routing user/email = user1-chain-c -> outboundTag = chain-c

Cascade scheme:

Client
  -> Main server :443
      -> outbound chain A -> Internet

Client
  -> Main server :443
      -> outbound chain B -> Internet

Client
  -> Main server :443
      -> outbound chain C -> Internet

This was possible before v3.2.5 by using multiple clients with the same subscription ID and different email/user values.

After v3.2.5, this is no longer possible because subId must be unique.

Using multiple inbounds is not a valid replacement here because all routes need to share the same public inbound endpoint on port 443.

This is why I believe the panel needs a separate subscription grouping mechanism or another stable per-link routing identity.

Mockups, screenshots, or examples

Possible client fields:

Email / routing user: user1-chain-a
Subscription group: user1
Inbound: vless-tcp-raw-443
Outbound route: chain-a
Email / routing user: user1-chain-b
Subscription group: user1
Inbound: vless-tcp-raw-443
Outbound route: chain-b
Email / routing user: user1-chain-c
Subscription group: user1
Inbound: vless-tcp-raw-443
Outbound route: chain-c

The subscription endpoint:

/sub/user1

would generate links for all clients with:

subscriptionGroup = user1

Example UI idea:

Client identity:
  Email: user1-chain-a

Subscription:
  Subscription group: user1

Routing:
  This client can still be matched by user/email in routing rules.

Example routing rule:

{
  "type": "field",
  "user": ["user1-chain-a"],
  "inboundTag": ["vless-tcp-raw-443"],
  "outboundTag": "chain-a"
}

Another routing rule:

{
  "type": "field",
  "user": ["user1-chain-b"],
  "inboundTag": ["vless-tcp-raw-443"],
  "outboundTag": "chain-b"
}

This preserves the advanced routing behavior while keeping subscription management inside 3x-ui.

Which parts of the panel would this affect?

Subscription (share links / Clash / JSON)

Are you willing to help?

  • I'd like to implement this feature myself and open a PR.
  • I can help test once a PR is open.

Before submitting

  • I searched existing issues and this feature has not been requested.
  • This feature request is written in English.
Originally created by @chuck852 on GitHub (Jun 1, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4776 ### Is your feature request related to a problem? ## Add a title [Feature]: Support multi-link subscriptions with separate routing identities --- ## Is your feature request related to a problem? Yes. This is not a duplicate of #4759 or #4775. Those issues describe the visible symptom: duplicate `subId` is no longer allowed after v3.2.5. This feature request is about the missing replacement design for a previously possible advanced routing use case. Before v3.2.5, it was possible to create several different clients with the same subscription ID: ```text client-a / email=route-a / subId=user1 / inbound=vless-tcp-raw-443 -> routing by user=route-a -> outboundTag=chain-a client-b / email=route-b / subId=user1 / inbound=vless-tcp-raw-443 -> routing by user=route-b -> outboundTag=chain-b client-c / email=route-c / subId=user1 / inbound=vless-tcp-raw-443 -> routing by user=route-c -> outboundTag=chain-c ``` This allowed one end user to have one subscription URL: ```text /sub/user1 ``` while the subscription contained several connection options. Each option had a different Xray `user/email`, so Xray routing could send each option to a different `outboundTag`. This is useful for cascade routing: ```text Client -> Main server :443 -> outbound chain A -> Internet Client -> Main server :443 -> outbound chain B -> Internet Client -> Main server :443 -> outbound chain C -> Internet ``` After v3.2.5, this model is no longer possible because multiple clients cannot share the same `subId`. The new “attach existing client to multiple inbounds” model does not fully replace this use case. It changes the routing discriminator from `user/email` to `inboundTag`. That means a separate inbound is required for each routing option. For single-port setups like VLESS TCP RAW on port 443, this is not a practical replacement. It is not possible to create several equivalent VLESS TCP RAW inbounds on the same IP and port only to separate routing paths. The core problem is that these three concepts are now coupled too tightly: ```text subscription grouping == client identity == routing identity ``` For advanced routing, they need to be separable: ```text subscription grouping != client identity != routing identity ``` ### Describe the solution you'd like I would like the panel to provide a supported way to create one subscription that contains multiple generated connection options, where each option can still have a separate routing identity. The required behavior is: ```text one subscription URL multiple generated links same inbound/IP/port possible different routing identities different outboundTags ``` Possible design 1: add a non-unique subscription grouping field Introduce a new field, for example: ```text subscriptionGroup ``` or: ```text subscriptionId ``` This field would be used only to group several clients into one subscription. Then the model could be: ```text email/user = unique, used for Xray routing client ID / internal ID = unique, used for client identity subscriptionGroup = non-unique, used to group several clients into one subscription ``` Example: ```text client email=route-a / subscriptionGroup=user1 -> outboundTag=chain-a client email=route-b / subscriptionGroup=user1 -> outboundTag=chain-b client email=route-c / subscriptionGroup=user1 -> outboundTag=chain-c ``` The subscription endpoint could then be: ```text /sub/user1 ``` and it would include all clients with: ```text subscriptionGroup=user1 ``` This keeps client identity unique while restoring multi-link subscriptions. Possible UI placement: * On the client edit/create modal: * keep `email` unique * keep current `subId` behavior if needed * add an optional `Subscription group` field * On the Clients page: * allow filtering/grouping by `Subscription group` * On the Subscription page/API: * generate the subscription by `subscriptionGroup` when it is set * preserve the current behavior for users who do not use this advanced field Possible design 2: add per-connection routing identity Another option is to introduce a per-generated-link routing identity. For example, each generated connection option inside a subscription could have: ```text routeId routeEmail connectionIdentity ``` Example: ```text Subscription owner: user1 Connection profile A: display name: user1 - chain A routing identity: user1-chain-a outboundTag: chain-a Connection profile B: display name: user1 - chain B routing identity: user1-chain-b outboundTag: chain-b ``` The important part is that the generated Xray configuration must expose a stable discriminator that can be used by routing rules. Possible design 3: advanced subscription profiles Add an advanced mode where a subscription can contain several profiles: ```text Subscription: user1 Profile A: inbound: vless-tcp-raw-443 routing user/email: route-a outboundTag: chain-a Profile B: inbound: vless-tcp-raw-443 routing user/email: route-b outboundTag: chain-b ``` This would allow one subscription to contain multiple server-side route profiles without requiring multiple inbounds on the same port. I am not asking to simply revert all v3.2.5 changes. I am asking for an explicit replacement design for the routing scenario that was possible before v3.2.5. ### Alternatives you've considered 1. Use “attach existing client to multiple inbounds” This does not fully solve the problem because routing then has to distinguish links by `inboundTag`. For my scenario, all connection options need to use the same public endpoint: ```text same IP same port 443 same VLESS TCP RAW inbound ``` I cannot create multiple equivalent TCP RAW inbounds on the same IP and port. 2. Create one inbound per cascade route This is not practical for single-port deployments. For example, VLESS TCP RAW on port 443 cannot be duplicated multiple times on the same IP and port. 3. Use different `subId` values This breaks the user experience because the end user no longer has one subscription URL. Instead, I would have to give them several subscription URLs: ```text /sub/user1-chain-a /sub/user1-chain-b /sub/user1-chain-c ``` The previous working behavior allowed one subscription URL with several connection options. 4. Use an external subscription aggregator This can work as a workaround, but it moves subscription logic outside 3x-ui. It also makes management, traffic accounting, link naming, and user lifecycle less consistent. 5. Roll back to v3.2.0 This is not a good long-term solution because v3.2.5 contains other fixes and improvements. The goal is to support the advanced routing use case in the current model, not to stay on an older version forever. 6. Use VLESS `vlessRoute` This is not a general solution. It is specific to VLESS and does not cover other protocols. It is also not exposed in 3x-ui as a normal subscription/profile management feature for this use case. ### Concrete use case I use 3x-ui for cascade routing. A single end user should receive one subscription URL, but inside that subscription they should have several connection options. Each option goes through the same public inbound endpoint but should be routed to a different outbound chain. Example: ```text Public inbound: protocol: VLESS transport: TCP RAW port: 443 Subscription: /sub/user1 Generated links inside this subscription: user1 - chain A user1 - chain B user1 - chain C ``` Server-side routing: ```text routing user/email = user1-chain-a -> outboundTag = chain-a routing user/email = user1-chain-b -> outboundTag = chain-b routing user/email = user1-chain-c -> outboundTag = chain-c ``` Cascade scheme: ```text Client -> Main server :443 -> outbound chain A -> Internet Client -> Main server :443 -> outbound chain B -> Internet Client -> Main server :443 -> outbound chain C -> Internet ``` This was possible before v3.2.5 by using multiple clients with the same subscription ID and different `email/user` values. After v3.2.5, this is no longer possible because `subId` must be unique. Using multiple inbounds is not a valid replacement here because all routes need to share the same public inbound endpoint on port 443. This is why I believe the panel needs a separate subscription grouping mechanism or another stable per-link routing identity. ### Mockups, screenshots, or examples Possible client fields: ```text Email / routing user: user1-chain-a Subscription group: user1 Inbound: vless-tcp-raw-443 Outbound route: chain-a ``` ```text Email / routing user: user1-chain-b Subscription group: user1 Inbound: vless-tcp-raw-443 Outbound route: chain-b ``` ```text Email / routing user: user1-chain-c Subscription group: user1 Inbound: vless-tcp-raw-443 Outbound route: chain-c ``` The subscription endpoint: ```text /sub/user1 ``` would generate links for all clients with: ```text subscriptionGroup = user1 ``` Example UI idea: ```text Client identity: Email: user1-chain-a Subscription: Subscription group: user1 Routing: This client can still be matched by user/email in routing rules. ``` Example routing rule: ```json { "type": "field", "user": ["user1-chain-a"], "inboundTag": ["vless-tcp-raw-443"], "outboundTag": "chain-a" } ``` Another routing rule: ```json { "type": "field", "user": ["user1-chain-b"], "inboundTag": ["vless-tcp-raw-443"], "outboundTag": "chain-b" } ``` This preserves the advanced routing behavior while keeping subscription management inside 3x-ui. ### Which parts of the panel would this affect? Subscription (share links / Clash / JSON) ### Are you willing to help? - [ ] I'd like to implement this feature myself and open a PR. - [x] I can help test once a PR is open. ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this feature has not been requested. - [x] This feature request is written in English.
bsakaguchi 2026-10-31 20:31:34 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Jun 1, 2026):

Thank you for this detailed and well-structured feature request. You are correct that this is distinct from #4759 and #4775 — those are symptom reports about the enforcement of unique subId, while this proposes an explicit replacement design for the advanced routing use case.

Summary of the core problem:
Before v3.2.5, sharing a subId across multiple clients with different email values allowed one subscription URL to carry multiple connection profiles, each routable to a different outboundTag. After v3.2.5 enforced subId uniqueness, this pattern no longer works and no direct equivalent exists.

On the three proposed designs:

  • Design 1 (non-unique subscriptionGroup field) appears to be the most practical path. It decouples subscription grouping from client identity while requiring relatively contained changes: a new optional field on the client model, a new subscription endpoint (or extension of the existing one) that aggregates by subscriptionGroup, and UI additions to the client create/edit modal. The email/routing identity remains unique and unchanged.

  • Design 2 (per-connection routing identity) adds more complexity to the data model but could be useful for other scenarios beyond cascade routing.

  • Design 3 (advanced subscription profiles) is the most flexible but also the most invasive to implement.

Areas of the codebase that would be affected by Design 1:

  • Client model / database schema (add subscriptionGroup field)
  • Subscription handler / link generation (query by subscriptionGroup)
  • Client create/edit UI modal
  • Possibly the clients list page (filter/group by subscriptionGroup)

If you or anyone else wants to open a PR for Design 1, it would be helpful to ensure backward compatibility: clients without a subscriptionGroup should continue to behave exactly as they do today with their individual subId.

We'll leave this open for discussion and a potential contribution.

<!-- gh-comment-id:4595202491 --> @github-actions[bot] commented on GitHub (Jun 1, 2026): Thank you for this detailed and well-structured feature request. You are correct that this is distinct from #4759 and #4775 — those are symptom reports about the enforcement of unique `subId`, while this proposes an explicit replacement design for the advanced routing use case. **Summary of the core problem:** Before v3.2.5, sharing a `subId` across multiple clients with different `email` values allowed one subscription URL to carry multiple connection profiles, each routable to a different `outboundTag`. After v3.2.5 enforced `subId` uniqueness, this pattern no longer works and no direct equivalent exists. **On the three proposed designs:** - **Design 1 (non-unique `subscriptionGroup` field)** appears to be the most practical path. It decouples subscription grouping from client identity while requiring relatively contained changes: a new optional field on the client model, a new subscription endpoint (or extension of the existing one) that aggregates by `subscriptionGroup`, and UI additions to the client create/edit modal. The `email`/routing identity remains unique and unchanged. - **Design 2 (per-connection routing identity)** adds more complexity to the data model but could be useful for other scenarios beyond cascade routing. - **Design 3 (advanced subscription profiles)** is the most flexible but also the most invasive to implement. **Areas of the codebase that would be affected by Design 1:** - Client model / database schema (add `subscriptionGroup` field) - Subscription handler / link generation (query by `subscriptionGroup`) - Client create/edit UI modal - Possibly the clients list page (filter/group by `subscriptionGroup`) If you or anyone else wants to open a PR for Design 1, it would be helpful to ensure backward compatibility: clients without a `subscriptionGroup` should continue to behave exactly as they do today with their individual `subId`. We'll leave this open for discussion and a potential contribution.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#3313
No description provided.