Xray-core icon indicating copy to clipboard operation
Xray-core copied to clipboard

[Feature request] XHTTP: support multiple/randomized paths (`pathList`)

Open pntrtr opened this issue 2 months ago • 4 comments

Problem

With XHTTP, path is a single static value on both client and server, so all traffic to a server goes to the same URL prefix. A real website doesn't serve all its traffic under one unusual path, so this constant path is an easy fingerprint for DPI/censors (e.g. TSPU in Russia).

Padding and header randomization already exist, but the path itself is never varied.

Proposal

Allow a list of paths in xhttpSettings:

"xhttpSettings": {
  "path": "/default",
  "pathList": ["/a/b/c", "/static/v2/app", "/api/events/stream"]
}
  • Client: pick a random entry from pathList per session (all requests sharing one session ID), and optionally per request where the mode allows it.
  • Server: accept every path in pathList as a valid entry point and route it to the same XHTTP handler. Other paths behave as they do today.
  • Compatibility: if pathList is unset, nothing changes. If both are set, path is treated as one more entry in the list.

Why in the core

I currently work around this with Caddy/nginx: the subscription is regenerated every few minutes with a random path, and the reverse proxy rewrites it back to the real one (matching upstream by a header from extra.headers). This has drawbacks:

  • It needs a reverse proxy and custom subscription tooling.
  • The path only changes when the subscription is refreshed, not per session/request.
  • Every provider has to reimplement the same logic.

Native support would work for any client built on Xray-core, with no extra infrastructure.

Open questions

  • Which XHTTP modes (packet-up, stream-up, stream-one) can safely support per-request selection, given session ID/seq are encoded in the path?
  • Should the server side support patterns (e.g. /static/*/app) or only exact matches?
  • Top-level xhttpSettings field or part of extra (so it can be carried in share links)?

pntrtr avatar Sep 28 '26 12:09 pntrtr

why this is needed?

vincentng295 avatar Sep 28 '26 12:09 vincentng295

路径只是一个被加密的字符串而已 外部观测不到

Fangliding avatar Sep 28 '26 13:09 Fangliding

why this is needed?

XHTTP is commonly deployed behind a CDN, and in that setup the CDN terminates TLS. That means the path is fully visible to a third party that:

  • sees every request URL in its logs and analytics,
  • can apply path-based WAF rules, rate limiting, or blocking,
  • can be pressured or configured to act on a specific URL.

pntrtr avatar Sep 28 '26 13:09 pntrtr

路径只是一个被加密的字符串而已 外部观测不到

path is encrypted then provider terminate TLS, but CDN can do it too, also watch reply above. thanks.

pntrtr avatar Sep 28 '26 13:09 pntrtr