[GH-ISSUE #5213] [Feature]: allow VLESS reverse proxy #3652

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

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

I'm trying to set up VLESS reverse proxy. The panel's client settings allows setting a reverse proxy tag for each client and properly sets it up. However the client has no way of automatically getting the correct configuration with reverse proxy, requiring manual setup.

Describe the solution you'd like

If a client has a reverse tag set, the panel should automatically generate a valid client configuration for them as described in the documentation. As of my knowledge, this can only be done in a JSON configuration as it requires an additional outbound and a routing rule.
Additionally, allowing the user to set custom JSON configuration templates for each client (and for each sub, while we are at it) could resolve this problem and give users much more flexibility in this field

Alternatives you've considered

Although one can manually create a valid client configuration, it's quite tedious to do with multiple outbounds. I've even considered hijacking the JSON sub response and altering it outside this app, but that would be rather unprofessional.

Concrete use case

VLESS reverse proxy is a solution for accepting incoming connections, which has many use cases such as hosting online games and torrenting.

Mockups, screenshots, or examples

No response

Which parts of the panel would this affect?

Xray config generation, 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 @lordtgm on GitHub (Jun 11, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5213 ### Is your feature request related to a problem? I'm trying to set up [VLESS reverse proxy](https://xtls.github.io/en/document/level-2/vless_reverse.html). The panel's client settings allows setting a reverse proxy tag for each client and properly sets it up. However the client has no way of automatically getting the correct configuration with reverse proxy, requiring manual setup. ### Describe the solution you'd like If a client has a reverse tag set, the panel should automatically generate a valid client configuration for them as described in the documentation. As of my knowledge, this can only be done in a JSON configuration as it requires an additional outbound and a routing rule. Additionally, allowing the user to set custom JSON configuration templates for each client (and for each sub, while we are at it) could resolve this problem and give users much more flexibility in this field ### Alternatives you've considered Although one can manually create a valid client configuration, it's quite tedious to do with multiple outbounds. I've even considered hijacking the JSON sub response and altering it outside this app, but that would be rather unprofessional. ### Concrete use case VLESS reverse proxy is a solution for accepting incoming connections, which has many use cases such as hosting online games and torrenting. ### Mockups, screenshots, or examples _No response_ ### Which parts of the panel would this affect? Xray config generation, 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.
Author
Owner

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

The gap you describe is confirmed in the source: the panel stores the per-client reverse.tag and injects it into the server-side Xray config, but the JSON subscription path does not yet generate a matching client-side reverse proxy configuration.

What currently happens

  • The client form exposes a reverseTag field for VLESS inbounds (frontend/src/pages/clients/ClientFormModal.tsx).
  • When set, it is saved as reverse: { tag: "<tag>" } on the client record (internal/database/model/model.go, ClientReverse struct).
  • When the server-side Xray config is built (internal/web/service/xray.go, GetXrayConfig()), that reverse object is passed into the inbound's client entry so Xray knows to treat that client as part of the reverse proxy tunnel.
  • The list of configured reverse tags is surfaced to the frontend via GetClientReverseTags() (internal/web/service/inbound.go:1129) so they can be referenced in the Xray config template routing rules — but the admin must wire those routing rules up manually.

What is missing

The JSON subscription generator (internal/sub/json_service.go, genVless(), line 315) reads client.Flow and client.ID but never checks client.Reverse. It emits a standard VLESS outbound with no reverse top-level section, no bridge/portal outbound, and no reverse-aware routing rules. A client that imports this JSON will behave as a normal proxy, not a reverse proxy bridge.

Share links (vless:// URIs, generated by genVlessLink() in internal/sub/service.go) have no standard mechanism for encoding reverse proxy configuration, so JSON subscription is the only viable delivery path for this.

Regarding per-client / per-sub custom templates

The JSON subscription service uses a single embedded default.json (internal/sub/default.json) as the base config and exposes only three global knobs (mux, rules, finalMask) via settings. There is currently no per-client or per-sub template override mechanism.

Scope of a potential implementation

A PR addressing the first part of the request would need to:

  1. In genVless() (or a new genVlessReverse() branch in getConfig()), detect client.Reverse \!= nil and, instead of a plain outbound, emit a config containing:
    • The VLESS outbound connecting to the bridge server (the inbound's address/port) with the tag referenced in the reverse section.
    • A reverse top-level section with a bridges entry pointing at that tag.
    • A routing rule to direct the bridge's internal traffic back through a freedom/loopback outbound.
  2. The exact shape depends on the Xray VLESS reverse proxy spec (portal vs. bridge roles at the client are not stored in the current ClientReverse struct, which only holds a tag string), so the data model may also need extending.

Per-client template overrides would be a broader feature and would likely be tracked separately.

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:4685707283 --> @github-actions[bot] commented on GitHub (Jun 11, 2026): The gap you describe is confirmed in the source: the panel stores the per-client `reverse.tag` and injects it into the **server-side** Xray config, but the JSON subscription path does not yet generate a matching client-side reverse proxy configuration. **What currently happens** - The client form exposes a `reverseTag` field for VLESS inbounds (`frontend/src/pages/clients/ClientFormModal.tsx`). - When set, it is saved as `reverse: { tag: "<tag>" }` on the client record (`internal/database/model/model.go`, `ClientReverse` struct). - When the server-side Xray config is built (`internal/web/service/xray.go`, `GetXrayConfig()`), that `reverse` object is passed into the inbound's client entry so Xray knows to treat that client as part of the reverse proxy tunnel. - The list of configured reverse tags is surfaced to the frontend via `GetClientReverseTags()` (`internal/web/service/inbound.go:1129`) so they can be referenced in the Xray config template routing rules — but the admin must wire those routing rules up manually. **What is missing** The JSON subscription generator (`internal/sub/json_service.go`, `genVless()`, line 315) reads `client.Flow` and `client.ID` but never checks `client.Reverse`. It emits a standard VLESS outbound with no `reverse` top-level section, no bridge/portal outbound, and no reverse-aware routing rules. A client that imports this JSON will behave as a normal proxy, not a reverse proxy bridge. Share links (`vless://` URIs, generated by `genVlessLink()` in `internal/sub/service.go`) have no standard mechanism for encoding reverse proxy configuration, so JSON subscription is the only viable delivery path for this. **Regarding per-client / per-sub custom templates** The JSON subscription service uses a single embedded `default.json` (`internal/sub/default.json`) as the base config and exposes only three global knobs (mux, rules, finalMask) via settings. There is currently no per-client or per-sub template override mechanism. **Scope of a potential implementation** A PR addressing the first part of the request would need to: 1. In `genVless()` (or a new `genVlessReverse()` branch in `getConfig()`), detect `client.Reverse \!= nil` and, instead of a plain outbound, emit a config containing: - The VLESS outbound connecting to the bridge server (the inbound's address/port) with the tag referenced in the `reverse` section. - A `reverse` top-level section with a `bridges` entry pointing at that tag. - A routing rule to direct the bridge's internal traffic back through a freedom/loopback outbound. 2. The exact shape depends on the Xray VLESS reverse proxy spec (portal vs. bridge roles at the client are not stored in the current `ClientReverse` struct, which only holds a `tag` string), so the data model may also need extending. Per-client template overrides would be a broader feature and would likely be tracked separately. *This reply was generated automatically; a maintainer may follow up.*
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#3652
No description provided.