mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #3864] xhttp custom headers not included in generated client links #2613
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#2613
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 @samush on GitHub (Feb 26, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/3864
Describe the bug
Good day,
When an xhttp inbound has custom headers configured, those headers are absent
from both the subscription link and the panel copy-link. Clients connecting
with the bare URL never send the headers, making the connection unusable in
setups that require them.
Use case
I use a custom header on the proxy server as a routing signal: requests that
carry the correct header are forwarded to xray, everything else gets a 404.
This is a lightweight defense against probing. Without the header being
present in the client link, there is no way for clients to connect
automatically — the header has to be added manually in each app.
Inbound configuration
Expected vs actual
Generated link (actual) —
extraparameter is missing:Working link (expected) —
extraencodes the headers:The correct URL was obtained by importing the broken link into the HAP app and
adding the header manually there — HAP then exports it with the
extraparameter properly encoded.
I am not a programmer, so i used ai-tools to find the way how to fix this issue
The following was found by claude.
Root cause
In
sub/subService.go,the
case "xhttp"block readsheadersonly to extract theHostvalue.All other headers are silently discarded:
The same omission exists in
web/assets/js/model/inbound.jsfor thepanel's copy-link button (
genVLESSLink,genSSLink,genTrojanLink).Suggested fix
Collect non-host headers, wrap them in
{"headers":{...}}, and store theURL-encoded JSON as
params["extra"]. The subsequenturl.Values.Encode()call applies a second encoding layer, which is what xray-core clients expect.
The same pattern applies to the
genTrojanLinkandgenShadowsocksLinkfunctions, and to the three
case "xhttp"blocks ininbound.js.I applied this fix locally, and at least subscription service now returns client's links with extra block.
Best regards
How to repeat the problem?
Expected action
Working link (expected) —
extraencodes the headers:Received action
Generated link (actual) —
extraparameter is missing:3x-ui Version
2.8.10
Xray-core Version
26.2.6
Checklist
@Arjentix commented on GitHub (May 28, 2026):
Note that
sniis also missing in generated url, this caused bugs for me