[GH-ISSUE #6988] [Feature]: Send Incy routing via the Routing header and option to reuse the Happ routing profile for Incy #4606

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

Originally created by @ilya-practicum on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6988

Describe the bug

When happ routing rules enabled, 3xui adds routing profile via header "routing". But when you enable Incy routing, 3xui send routing via body not header. Incy also supports header "routing", it may be better to use header "routing" for Incy also to make it predictable.

P. S. It will also be useful to add check box to send same routing profile for Happ and Incy, since Incy supports "happ://" routing profiles

How to reproduce the problem

  1. Enable Incy routing in 3xui panel
  2. Get subscription

Expected behavior

No response

Actual behavior

No response

Relevant logs


Screenshots

No response

3x-ui version

3.11.0

Xray-core version

No response

How did you install 3x-ui?

Docker / Docker Compose

Operating system

Debian 13

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

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
Originally created by @ilya-practicum on GitHub (Oct 28, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6988 ### Describe the bug When happ routing rules enabled, 3xui adds routing profile via header "routing". But when you enable Incy routing, 3xui send routing via body not header. Incy also supports header "routing", it may be better to use header "routing" for Incy also to make it predictable. P. S. It will also be useful to add check box to send same routing profile for Happ and Incy, since Incy supports "happ://" routing profiles ### How to reproduce the problem 1. Enable Incy routing in 3xui panel 2. Get subscription ### Expected behavior _No response_ ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.11.0 ### Xray-core version _No response_ ### How did you install 3x-ui? Docker / Docker Compose ### Operating system Debian 13 ### 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 - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:40:52 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 28, 2026):

Your observation is accurate, but it is intended behaviour, not a bug: since the fix for #6062 (commit 61885c91, PR #6810, released before v3.11.0), the panel writes the Incy routing profile into the raw subscription body on purpose, and removes the Routing header for Incy clients. I have relabelled this as a feature request, because both of your points ask for a design change. I also retitled it; the old title was "[Bug]: Incy routing does not add header".

Why the body and not the header

In internal/sub/controller.go:520-529 (raw /sub/ handler):

// Incy's profile rides the raw body; other clients must not see that line (#6062).
if IsIncyClient(userAgent) && a.subIncyEnableRouting && a.subIncyRoutingRules != "" {
    incyRules, _, err := resolveIncyRoutingSource(a.subIncyRoutingRules)
    if err == nil && strings.TrimSpace(incyRules) != "" {
        result.WriteString(incyRules)
        ...
        // INCY ranks a Routing header above a body line, so the shared
        // profile must not override INCY's own one here.
        c.Writer.Header().Del("Routing")

The Routing header is built for every client in ApplyCommonHeaders (internal/sub/controller.go:974-997). For Incy, the Happ value is dropped there, and only the shared JSON-routing profile (subJsonRoutingRules) stays in that header. The header is how Happ/Incy fetch the geo files that the baked rules reference (#6402). If Incy's own profile were sent in the header instead, it would replace that shared profile on the /sub/ response. That trade-off is what the current design avoids. The test TestIncyRoutingIsolatedFromHappHeaders (internal/sub/controller_test.go:806) pins this. The case "incy body profile is not outranked by a routing header" expects the incy:// line at the end of the body and an empty Routing header.

So the request for "Incy routing via the Routing header" is a change in behaviour that the maintainer would need to decide on. It is not a regression.

Same profile for Happ and Incy: workaround available today

A checkbox for this does not exist. The Happ tab's routing is deliberately hidden from Incy (controller.go:974: "The Happ tab is Happ-only, so INCY reads it as blank ... INCY takes a routing link of any scheme"). However, the Incy routing field accepts any link scheme. The value is only rewritten when it is an https:// URL: ParseRemoteRoutingURL (internal/util/common/url.go:34) treats everything else as literal text, and resolveIncyRoutingSource (internal/sub/remote_routing.go:474) returns it unchanged. To make Incy use your Happ profile:

  1. In the panel's subscription settings, open the Incy section and enable Incy routing.
  2. Paste the same happ://routing/... link you use on the Happ tab into the Incy routing rules field.

Incy will then receive that happ:// line in the subscription body. The only downside is that the link is stored twice, and both copies must be edited when it changes. Removing that duplication is what the requested checkbox would do.

Verdict: Feature request

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

<!-- gh-comment-id:6465381241 --> @github-actions[bot] commented on GitHub (Oct 28, 2026): Your observation is accurate, but it is intended behaviour, not a bug: since the fix for #6062 (commit `61885c91`, PR #6810, released before v3.11.0), the panel writes the Incy routing profile into the raw subscription **body** on purpose, and removes the `Routing` header for Incy clients. I have relabelled this as a feature request, because both of your points ask for a design change. I also retitled it; the old title was "[Bug]: Incy routing does not add header". **Why the body and not the header** In `internal/sub/controller.go:520-529` (raw `/sub/` handler): ```go // Incy's profile rides the raw body; other clients must not see that line (#6062). if IsIncyClient(userAgent) && a.subIncyEnableRouting && a.subIncyRoutingRules != "" { incyRules, _, err := resolveIncyRoutingSource(a.subIncyRoutingRules) if err == nil && strings.TrimSpace(incyRules) != "" { result.WriteString(incyRules) ... // INCY ranks a Routing header above a body line, so the shared // profile must not override INCY's own one here. c.Writer.Header().Del("Routing") ``` The `Routing` header is built for every client in `ApplyCommonHeaders` (`internal/sub/controller.go:974-997`). For Incy, the Happ value is dropped there, and only the shared JSON-routing profile (`subJsonRoutingRules`) stays in that header. The header is how Happ/Incy fetch the geo files that the baked rules reference (#6402). If Incy's own profile were sent in the header instead, it would replace that shared profile on the `/sub/` response. That trade-off is what the current design avoids. The test `TestIncyRoutingIsolatedFromHappHeaders` (`internal/sub/controller_test.go:806`) pins this. The case `"incy body profile is not outranked by a routing header"` expects the `incy://` line at the end of the body and an empty `Routing` header. So the request for "Incy routing via the `Routing` header" is a change in behaviour that the maintainer would need to decide on. It is not a regression. **Same profile for Happ and Incy: workaround available today** A checkbox for this does not exist. The Happ tab's routing is deliberately hidden from Incy (`controller.go:974`: "The Happ tab is Happ-only, so INCY reads it as blank ... INCY takes a routing link of any scheme"). However, the Incy routing field accepts any link scheme. The value is only rewritten when it is an `https://` URL: `ParseRemoteRoutingURL` (`internal/util/common/url.go:34`) treats everything else as literal text, and `resolveIncyRoutingSource` (`internal/sub/remote_routing.go:474`) returns it unchanged. To make Incy use your Happ profile: 1. In the panel's subscription settings, open the Incy section and enable Incy routing. 2. Paste the same `happ://routing/...` link you use on the Happ tab into the Incy routing rules field. Incy will then receive that `happ://` line in the subscription body. The only downside is that the link is stored twice, and both copies must be edited when it changes. Removing that duplication is what the requested checkbox would do. Verdict: Feature request _This reply was generated automatically; a maintainer may follow up._ <!-- claude-issue:analyst -->
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#4606
No description provided.