XTLS / Xray-core

Xray, Penetrates Everything. Also the best v2ray-core, with XTLS support. Fully compatible configuration.
https://t.me/projectXray
Mozilla Public License 2.0
25.47k stars 3.94k forks source link

客户端 HTTPupgrade 自定义 headers 的 host 值无效 #3191

Closed chika0801 closed 7 months ago

chika0801 commented 7 months ago

服务端用Nginx监听443,传递到Xray的形式

服务端Nginx配置里使用了 ssl_reject_handshake 防止被扫SSL证书中的域名

服务端Xray配置

客户端Xray配置

两端Xray版本使用 https://github.com/XTLS/Xray-core/commit/9a619f9e7c5d92867b248f6bba55c35cbff7dfdd [Add support for HTTPupgrade custom headers] 截止3.27日自编译的版本文件

当客户端windows,Xray配置中出站的address填写VPS的IP,

httpupgrade配置如下

            "streamSettings": {
                "network": "httpupgrade",
                "httpupgradeSettings": {
                    "path": "/lovelive",
                    "headers": {
                        "host": "服务端SSL证书中包含的域名"
                    }
                },
                "security": "tls",
                "tlsSettings": {
                    "serverName": "服务端SSL证书中包含的域名",
                    "fingerprint": "chrome"
                }
            },

此时客户端连接失败,原因是因为服务端Nginx配置中用了ssl_reject_handshake。但是按提交介绍此时headers自定义了host,应该能成功连接才对。

修改为如下配置,客户端连接成功

            "streamSettings": {
                "network": "httpupgrade",
                "httpupgradeSettings": {
                    "path": "/lovelive",
                    "host": "服务端SSL证书中包含的域名"
                },
                "security": "tls",
                "tlsSettings": {
                    "serverName": "服务端SSL证书中包含的域名",
                    "fingerprint": "chrome"
                }
            },
chika0801 commented 7 months ago

@Fangliding 有时间的话,看一看了

Fangliding commented 7 months ago

@chika0801 emm 我当初以为写了才会覆盖 不知道它默认会把address填进去导致没写host也会覆盖掉header里写的host 在文档里马一下好了

RPRX commented 7 months ago

@Fangliding 改代码,优先级应该是 host > headers > address

Fangliding commented 7 months ago

@RPRX OK 我回去看下

chika0801 commented 7 months ago

测试了 https://github.com/XTLS/Xray-core/pull/3193 此版本,已解决

alipour66m commented 3 months ago

after this upgrade, any Cname domain does not work for ws Host, and only the domain defined in panle is working. Can you enable multi Cname domain for host?