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

Cloudflare Tunnel + XHTTP 模式兼容性问题

Open oKatTjC opened this issue 10 months ago • 2 comments

问题背景:

我有两台 LXC 架构的 VPS,来自不同商家:

  • 日本 VPS
  • 荷兰 VPS

遇到的问题:

在 Cloudflare Tunnel 和 Xray 配置完全相同的情况下:

  • 日本 VPS:三种模式(packet-up、stream-up、stream-one)都能正常使用
  • 荷兰 VPS:只有 packet-up 模式可用

服务端配置详情:

方案一:通过 CF Tunnel(问题出现)

{
  "tag": "tunnel",
  "listen": "127.0.0.1",
  "port": 100,
  "protocol": "vless",
  "settings": {
    "clients": [{"id": "uuid"}],
    "decryption": "123"
  },
  "streamSettings": {
    "network": "xhttp",
    "security": "none",
    "xhttpSettings": {
      "path": "/path",
      "scStreamUpServerSecs": "20-80"
    }
  }
}

使用此配置时,荷兰 VPS 仅支持 packet-up 模式。

注: Cloudflare Tunnel 的 --protocol 参数无论设置为 http2 还是使用默认值,结果都一样。

方案二:直接 TLS(两台都正常)

{
  "tag": "tls",
  "listen": "0.0.0.0",
  "port": 200,
  "protocol": "vless",
  "settings": {
    "clients": [{"id": "uuid"}],
    "decryption": "123"
  },
  "streamSettings": {
    "network": "xhttp",
    "security": "tls",
    "tlsSettings": {
      "serverName": "abc.xx.com",
      "alpn": ["h2"],
      "certificates": [{
        "certificateFile": "cf.pem",
        "keyFile": "cf.key"
      }]
    },
    "xhttpSettings": {
      "path": "/path",
      "scStreamUpServerSecs": "20-80"
    }
  }
}

使用此配置时,日本和荷兰 VPS 都支持三种模式。

疑问:

是否是宿主机层面的限制导致的?还是其他原因?

oKatTjC avatar Jan 21 '26 09:01 oKatTjC

我最开始研究这些行为的时候桌面堆了四五个用于测试的python文件 一般来说不应该有区别的 折腾不好的话可以自己研究研究 我们没法帮忙

Fangliding avatar Jan 21 '26 09:01 Fangliding

不好意思,之前忘记看软件版本了,xray 的版本不一样

cloudflared 版本相同,都是最新的 2026.1.1

服务端 v26.1.18 无法使用 cf tunnel + xhttp stream-up模式

服务端 v25.12.8 能够使用 cf tunnel + xhttp stream-up模式

不是vps的差异

oKatTjC avatar Jan 23 '26 14:01 oKatTjC