xhttp无法使用stream-up通过CloudflareCDN
完整性要求
- [x] 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
- [x] 我提供了完整的配置文件和日志,而不是出于自己的判断只给出截取的部分。
- [x] 我搜索了 issues, 没有发现已提出的类似问题。
- [x] 问题在 Release 最新的版本上可以成功复现
描述
在新版本v25.1.30中通过CloudflareCDN的vless-xhttp-tls无法使用stream-up通过,packet-up可正常通过,在尝试历史提交的自动构建版本后,发现在https://github.com/XTLS/Xray-core/commit/ca9a90221348dcc555885ce6537a7cdcef5f4257 后的测试构建都无法使用stream-up通过CloudflareCDN,在此之前的测试构建可使用stream-up通过(本人通过Cloudflare Tunnel连接)
重现方式
在新版本v25.1.30中使用通过CloudflareCDN的xhttp配置,alpn为h2,mode为auto或stream-up
客户端配置
{
"log": {
"loglevel": "info"
},
"inbounds": [
{
"tag": "socks",
"port": 40000,
"listen": "0.0.0.0",
"protocol": "socks",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
],
"routeOnly": false
},
"settings": {
"auth": "noauth",
"udp": true,
"allowTransparent": false
}
},
{
"tag": "api",
"port": 40004,
"listen": "127.0.0.1",
"protocol": "dokodemo-door",
"settings": {
"address": "127.0.0.1"
}
}
],
"outbounds": [
{
"tag": "proxy",
"protocol": "vless",
"settings": {
"vnext": [
{
"address": "www.visa.com.hk",
"port": 8443,
"users": [
{
"id": "b6c9c26f-ea93-4c93-b39a-98fe0926db47",
"email": "[email protected]",
"security": "auto",
"encryption": "none"
}
]
}
]
},
"streamSettings": {
"network": "xhttp",
"security": "tls",
"tlsSettings": {
"allowInsecure": true,
"serverName": "connect.cloudflare",
"alpn": [
"h2"
],
"fingerprint": "firefox"
},
"xhttpSettings": {
"path": "/xxx",
"mode": "auto",
"extra": {
"downloadSettings": {
"address": "www.visa.com.hk",
"port": 8443,
"network": "xhttp",
"security": "tls",
"tlsSettings": {
"allowInsecure": true,
"serverName": "connect.cloudflare",
"alpn": [
"h2"
]
},
"xhttpSettings": {
"path": "/xxx"
}
}
}
}
},
"mux": {
"enabled": false,
"concurrency": -1
}
},
{
"tag": "direct",
"protocol": "freedom",
"settings": {
"domainStrategy": "UseIP",
"userLevel": 0
}
},
{
"tag": "block",
"protocol": "blackhole"
}
],
"stats": {},
"metrics": {
"tag": "api"
},
"policy": {
"system": {
"statsOutboundUplink": true,
"statsOutboundDownlink": true
}
},
"dns": {
"hosts": {
"geosite:category-ads-all": "127.0.0.1",
"domain:bilivideo.cn": "127.0.0.1",
"domain:szbdyd.com": "127.0.0.1",
"domain:googleapis.cn": "googleapis.com",
"domain:fonts.googleapis.com": "fonts.googleapis.com",
"domain:gstatic.com": "www.gstatic.cn",
"dns.google": "8.8.4.4",
"proxy.example.com": "127.0.0.1"
},
"servers": [
{
"address": "223.5.5.5",
"domains": [
"geosite:cn"
],
"expectIPs": [
"geoip:cn"
]
},
"223.6.6.6",
"1.0.0.1",
"8.8.4.4",
"https://dns.google/dns-query",
{
"address": "223.5.5.5",
"domains": [
"www.visa.com.hk"
]
}
]
},
"routing": {
"domainStrategy": "IPIfNonMatch",
"domainMatcher": "mph",
"rules": [
{
"type": "field",
"inboundTag": [
"api"
],
"outboundTag": "api"
},
{
"type": "field",
"port": "0-65535",
"outboundTag": "proxy"
}
]
}
}
服务端配置
{
"log":{
"loglevel":"debug"
},
"inbounds":[
{
"tag": "xhttp-vless",
"port":3006,
"listen":"127.0.0.1",
"protocol":"vless",
"settings":{
"clients":[
{
"id":"xxx",
"level":0
}
],
"decryption":"none"
},
"streamSettings":{
"network":"xhttp",
"security":"none",
"sockopt": {
"domainStrategy": "UseIPv4v6"
},
"xhttpSettings": {
"path": "/xxxx",
"mode": "auto"
}
},
"sniffing":{
"enabled":true,
"destOverride":[
"http",
"tls"
],
"metadataOnly":false
}
},
{
"tag": "xhttp-warp-vless",
"port":3007,
"listen":"127.0.0.1",
"protocol":"vless",
"settings":{
"clients":[
{
"id":"xxx",
"level":0
}
],
"decryption":"none"
},
"streamSettings":{
"network":"xhttp",
"security":"none",
"sockopt": {
"domainStrategy": "UseIPv4v6"
},
"xhttpSettings": {
"path": "/xxx"
}
},
"sniffing":{
"enabled":true,
"destOverride":[
"http",
"tls"
],
"metadataOnly":false
}
}
],
"dns":{
"servers":[
"https+local://1.1.1.1/dns-query",
"https+local://8.8.8.8/dns-query"
]
},
"outbounds": [
{
"tag": "direct",
"protocol": "freedom",
"settings": {
"domainStrategy": "UseIPv4"
}
},
{
"tag": "WARP",
"protocol": "socks",
"settings": {
"servers": [
{
"address": "127.0.0.1",
"port": 40000
}
]
},
"streamSettings": {
"sockopt": {
"domainStrategy": "UseIPv4v6"
}
}
}
],
"routing": {
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"type": "field",
"outboundTag": "direct",
"domain": [
"domain:ip.sb"
]
}
]
}
}
客户端日志
启动服务(2025/02/06 20:26:56)...
Xray 25.1.30 (Xray, Penetrates Everything.) 0a8470c (go1.23.5 windows/amd64)
A unified platform for anti-censorship.
2025/02/06 20:26:58.909966 [Info] infra/conf/serial: Reading config: &{Name:config.json Format:json}
[VLESS] Lade.io-Australia-Main(www***hk:8443)
2025/02/06 20:26:59.831937 [Debug] app/log: Logger started
2025/02/06 20:27:00.157744 [Info] app/dns: DNS: created UDP client initialized for 223.5.5.5:53
2025/02/06 20:27:00.472191 [Info] app/dns: DNS: created UDP client initialized for 223.6.6.6:53
2025/02/06 20:27:00.472191 [Info] app/dns: DNS: created UDP client initialized for 1.0.0.1:53
2025/02/06 20:27:00.472191 [Info] app/dns: DNS: created UDP client initialized for 8.8.4.4:53
2025/02/06 20:27:00.472191 [Info] app/dns: DNS: created Remote DNS-over-HTTPS client for https://dns.google/dns-query, with h2c false
2025/02/06 20:27:00.472191 [Info] app/dns: DNS: created UDP client initialized for 223.5.5.5:53
2025/02/06 20:27:00.472191 [Debug] app/proxyman/inbound: creating stream worker on 0.0.0.0:40000
2025/02/06 20:27:00.472191 [Debug] app/proxyman/inbound: creating stream worker on 127.0.0.1:7585
2025/02/06 20:27:00.472191 [Debug] app/stats: create new counter outbound>>>proxy>>>traffic>>>uplink
2025/02/06 20:27:00.472191 [Debug] app/stats: create new counter outbound>>>proxy>>>traffic>>>downlink
2025/02/06 20:27:00.472191 [Debug] app/stats: create new counter outbound>>>direct>>>traffic>>>uplink
2025/02/06 20:27:00.472191 [Debug] app/stats: create new counter outbound>>>direct>>>traffic>>>downlink
2025/02/06 20:27:00.473208 [Debug] app/stats: create new counter outbound>>>block>>>traffic>>>uplink
2025/02/06 20:27:00.473208 [Debug] app/stats: create new counter outbound>>>block>>>traffic>>>downlink
2025/02/06 20:27:00.482976 [Info] transport/internet/tcp: listening TCP on 0.0.0.0:40000
2025/02/06 20:27:00.482976 [Info] transport/internet/udp: listening UDP on 0.0.0.0:40000
2025/02/06 20:27:00.482976 [Info] transport/internet/tcp: listening TCP on 127.0.0.1:7585
2025/02/06 20:27:00.482976 [Warning] core: Xray 25.1.30 started
2025/02/06 20:27:02.176966 [Info] [3528069492] proxy/socks: Connection closed immediately, likely health check connection
2025/02/06 20:27:02.184445 [Info] [916354666] proxy/socks: TCP Connect request to tcp:www.google.com:443
2025/02/06 20:27:02.186471 [Info] [916354666] app/dispatcher: sniffed domain: www.google.com
2025/02/06 20:27:02.186471 [Info] [916354666] app/dispatcher: taking detour [proxy] for [tcp:www.google.com:443]
2025/02/06 20:27:02.186578 from tcp:127.0.0.1:8829 accepted tcp:www.google.com:443 [socks -> proxy]
2025/02/06 20:27:02.186578 [Debug] [916354666] transport/internet/splithttp: XMUX: creating xmuxClient because xmuxClients is empty
2025/02/06 20:27:02.186578 [Info] [916354666] transport/internet/splithttp: XHTTP is dialing to tcp:www.visa.com.hk:8443, mode stream-up, HTTP version 2, host lxxx
2025/02/06 20:27:02.186578 [Debug] [916354666] transport/internet/splithttp: XMUX: creating xmuxClient because xmuxClients is empty
2025/02/06 20:27:02.186578 [Info] [916354666] transport/internet/splithttp: XHTTP is downloading from tcp:ipv4.cmcc.cf.ip.huacloud.eu.org:8443, mode stream-down, HTTP version 2, host lxxxx
2025/02/06 20:27:02.186578 [Debug] [916354666] transport/internet: dialing to tcp:www.visa.com.hk:8443
2025/02/06 20:27:02.228322 [Debug] [3739436004] proxy/dokodemo: processing connection from: 127.0.0.1:8832
2025/02/06 20:27:02.228322 [Info] [3739436004] proxy/dokodemo: received request for 127.0.0.1:8832
2025/02/06 20:27:02.228322 [Info] [3739436004] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:0]
2025/02/06 20:27:02.228322 from 127.0.0.1:8832 accepted tcp:127.0.0.1:0 [api -> api]
2025/02/06 20:27:02.268396 [Debug] [916354666] transport/internet: dialing to tcp:www.visa.com.hk:8443
2025/02/06 20:27:02.470936 [Info] [916354666] proxy/vless/outbound: tunneling request to tcp:www.google.com:443 via www.visa.com.hk:8443
2025/02/06 20:27:04.173364 [Info] [916354666] app/proxyman/inbound: connection ends > proxy/socks: connection ends > context canceled
2025/02/06 20:27:05 当前延迟: -1 ms,none
服务端日志
Xray 25.1.30 (Xray, Penetrates Everything.) 0a8470c (go1.23.5 linux/amd64)
A unified platform for anti-censorship.
2025/02/06 11:17:08.186380 [Info] infra/conf/serial: Reading config: &{Name:config.json Format:json}
2025/02/06 11:17:09.041577 [Debug] app/log: Logger started
2025/02/06 11:17:09.186575 [Info] app/dns: DNS: created Local DNS-over-HTTPS client for https://1.1.1.1/dns-query
2025/02/06 11:17:09.346068 [Debug] app/router: MphDomainMatcher is enabled for 1 domain rule(s)
2025/02/06 11:17:09.346146 [Debug] app/router: MphDomainMatcher is enabled for 2 domain rule(s)
2025/02/06 11:17:09.346200 [Debug] app/router: MphDomainMatcher is enabled for 3 domain rule(s)
2025/02/06 11:17:09.346251 [Debug] app/router: MphDomainMatcher is enabled for 19 domain rule(s)
2025/02/06 11:17:09.346301 [Debug] app/router: MphDomainMatcher is enabled for 220 domain rule(s)
2025/02/06 11:17:09.346351 [Debug] app/router: MphDomainMatcher is enabled for 4 domain rule(s)
2025/02/06 11:17:09.346401 [Debug] app/router: MphDomainMatcher is enabled for 3594 domain rule(s)
2025/02/06 11:17:10.037344 [Debug] app/router: MphDomainMatcher is enabled for 94738 domain rule(s)
2025/02/06 11:17:10.216709 [Debug] app/proxyman/inbound: creating stream worker on 0.0.0.0:8080
2025/02/06 11:17:10.239697 [Debug] app/proxyman/inbound: creating stream worker on 127.0.0.1:3001
2025/02/06 11:17:10.239806 [Debug] app/proxyman/inbound: creating stream worker on 127.0.0.1:3002
2025/02/06 11:17:10.252201 [Debug] app/proxyman/inbound: creating stream worker on 127.0.0.1:3003
2025/02/06 11:17:10.252282 [Debug] app/proxyman/inbound: creating stream worker on 127.0.0.1:3004
2025/02/06 11:17:10.252586 [Debug] app/proxyman/inbound: creating stream worker on 127.0.0.1:3005
2025/02/06 11:17:10.252648 [Debug] app/proxyman/inbound: creating stream worker on 127.0.0.1:3006
2025/02/06 11:17:10.252701 [Debug] app/proxyman/inbound: creating stream worker on 127.0.0.1:3007
2025/02/06 11:17:10.277809 [Info] transport/internet/websocket: listening TCP(for WS) on 127.0.0.1:3004
2025/02/06 11:17:10.277895 [Info] transport/internet/websocket: listening TCP(for WS) on 127.0.0.1:3005
2025/02/06 11:17:10.277948 [Info] transport/internet/splithttp: listening TCP for XHTTP on 127.0.0.1:3006
2025/02/06 11:17:10.278052 [Info] transport/internet/splithttp: listening TCP for XHTTP on 127.0.0.1:3007
2025/02/06 11:17:10.278116 [Info] transport/internet/tcp: listening TCP on 0.0.0.0:8080
2025/02/06 11:17:10.278205 [Info] transport/internet/websocket: listening TCP(for WS) on 127.0.0.1:3001
2025/02/06 11:17:10.278260 [Info] transport/internet/websocket: listening TCP(for WS) on 127.0.0.1:3002
2025/02/06 11:17:10.278313 [Info] transport/internet/websocket: listening TCP(for WS) on 127.0.0.1:3003
2025/02/06 11:17:10.278367 [Warning] core: Xray 25.1.30 started
2025/02/06 11:17:10.326903 [Info] app/dispatcher: taking platform initialized detour [WARP] for [tcp:www.gstatic.com:80]
2025/02/06 11:17:10.327046 [Info] transport/internet/tcp: dialing TCP to tcp:127.0.0.1:40000
2025/02/06 11:17:10.327204 [Debug] transport/internet: dialing to tcp:127.0.0.1:40000
2025/02/06 11:17:10.992570 [Info] app/observatory: the outbound WARP is alive:0.650649331
2025/02/06 11:17:21.011949 [Info] app/dispatcher: taking platform initialized detour [WARP] for [tcp:www.gstatic.com:80]
2025/02/06 11:17:21.013305 [Info] transport/internet/tcp: dialing TCP to tcp:127.0.0.1:40000
2025/02/06 11:17:21.013638 [Debug] transport/internet: dialing to tcp:127.0.0.1:40000
2025/02/06 11:17:21.485899 [Info] app/observatory: the outbound WARP is alive:0.49275722
2025/02/06 11:17:31.497189 [Info] app/dispatcher: taking platform initialized detour [WARP] for [tcp:www.gstatic.com:80]
2025/02/06 11:17:31.498576 [Info] transport/internet/tcp: dialing TCP to tcp:127.0.0.1:40000
2025/02/06 11:17:31.498771 [Debug] transport/internet: dialing to tcp:127.0.0.1:40000
2025/02/06 11:17:31.932853 [Info] app/observatory: the outbound WARP is alive:0.437811127
2025/02/06 11:17:32.069322 [Info] [3571813772] proxy/vless/inbound: firstLen = 0
2025/02/06 11:17:32.069691 [Info] [3571813772] app/proxyman/inbound: connection ends > proxy/vless/encoding: failed to read request version > EOF
它可能具有我之前所推测的行为 允许请求流式通过但是并非全双工不允许双向流 服务端如果回复会导致该连接被打断 解决办法可能就是 关掉?毕竟也提供了选项
它可能具有我之前所推测的行为 允许请求流式通过但是并非全双工不允许双向流 服务端如果回复会导致该连接被打断 解决办法可能就是 关掉?毕竟也提供了选项
是指只使用packet-up而不使用stream-up吗
"scStreamUpServerSecs": "-1" 大概这样?
https://github.com/XTLS/Xray-core/discussions/4113#discussioncomment-12027447
Nginx 需改为 grpc_pass
Nginx 需改为 grpc_pass
@Suyunmeng 这样解决了问题吗
一样使用cloudflare tunnel,同样的问题,尝试回退25.1.1版本后正常了
@RPRX 已经解决问题了
@Paladin-F 在cloudflare tunnel的设置中要使用https,还有要调高级设置,而且必须装nginx或caddy来反代xray,nginx直接grpc_pass,caddy要在配置文件里写清楚使用h2c回源
@Suyunmeng 昨天查下来的结论也是说tunnel的反代不支持h2c,要加证书,但是我不理解为啥25.1.1版本可以不用证书直接反代
@Paladin-F 之前的xray版本对xhttp的连接是默认同时支持http/1.1和h2c回源,但25.1.30做出了一项更改优化CF的连接https://github.com/XTLS/Xray-core/pull/4306 它优化了stream-up的连接,但也使其不能直接接受传统http/1.1的连接请求,只支持h2c连接,才导致了这个问题,如果你切换成packet-up就会发现不用改也能重新连上了,因为服务端现在需要保活维持并行传输,http/1.1作为半双工不能实现,而h2c作为全双工,可以主动推送数据给客户端保活,因此才变为只能通过h2c传输
@Suyunmeng 明白了,感谢说明!
@Paladin-F 在cloudflare tunnel的设置中要使用https,还有要调高级设置,而且必须装nginx或caddy来反代xray,nginx直接grpc_pass,caddy要在配置文件里写清楚使用h2c回源
tunnel 可以不用https,nginx配置无证书回源,
server {
listen 3107;
http2 on;
server_name _;
}
之前也是研究了一下,我是用的caddy,cf开启可以grpc回源,然后直接把caddy的监听端口设置可以接收h2c,并且反向代理可以处理h2c流量就行了
v25.12.8能用Cloudflare Tunnel+stream-up, 新版只能packet-up, 是怎么回事
服务端配置
{
"inbounds": [
{
"listen": "127.0.0.1",
"port": 100,
"protocol": "vless",
"settings": {
"clients": [
{
"id": "uuid",
"flow": "xtls-rprx-vision"
}
],
"decryption": "mlkem768x25519plus.native.600s..."
},
"streamSettings": {
"network": "xhttp",
"security": "none",
"xhttpSettings": {
"path": "/path",
"scStreamUpServerSecs": "20-80"
}
}
}
]
}
v25.12.8能用Cloudflare Tunnel+stream-up, 新版只能packet-up, 是怎么回事
服务端配置
也碰到这个问题了
