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.86k stars 3.98k forks source link

tls+reality+本机自建站,有概率暴露自建站的端口 #3944

Closed maryjeck closed 1 month ago

maryjeck commented 1 month ago

完整性要求

描述

版本 v24.9.30 有概率暴露自建站的端口

重现方式

带路径访问 http://xxx.com/adjet.php 正常会导向 https://xxx.com/adjet.php 但实际会导向reality转发的站址, https://xxx.com:9999/adjet.php (浏览器中显示)

但直接从https://xxx.com/adjet.php 访问 又正常 是 https://xxx.com/adjet.php (浏览器中显示)

客户端配置


{
    "tag": "proxy",
    "protocol": "vless",
    "settings":
    {
        "vnext": [
        {
            "address": "xxxx.com", #服务器域名
            "port": 443,
            "users": [
            {
                "id": "xxxxx-xxxx-xxx-xxxxx",
                "flow": "xtls-rprx-vision"
            }]
        }]
    },
    "streamSettings":
    {
        "network": "tcp",
        "security": "reality",
        "realitySettings":
        {
            "serverName": "xxxx.com", #服务器域名
            "fingerprint": "randomized",
            "show": false,
            "publicKey": "xxxxxxx",
            "shortId": "xxxxxxx",
            "spiderX": ""
        }
    },
    "mux":
    {
        "enabled": false,
        "concurrency": -1,
        "xudpConcurrency": 16,
        "xudpProxyUDP443": "reject"
    }
}

服务端配置


{
    "port": 443,
    "protocol": "vless",
    "settings":
    {
        "clients": [
        {
            "id": "xxxxxx-xxxx-xxx-xxxx", 
            "flow": "xtls-rprx-vision",
            "level": 0
        }],
        "decryption": "none"
    },
    "streamSettings":
    {
        "network": "tcp",
        "security": "reality",
        "realitySettings":
        {
            "show": false,
            "dest": "xxxxx.com:9999", #域名为服务器本机域名
            "xver": 0,
            "serverNames": [
                "xxxxx.com",#域名为服务器本机域名
                "amazon.com",
                "www.amazon.com"
            ],
            "privateKey": "xxxxxxxxxxx",
            "minClientVer": "",
            "maxClientVer": "",
            "maxTimeDiff": 0,
            "shortIds": [
                "",
                "xxxxxxxx"
            ]
        }
    }
}

客户端日志

服务端日志

Fangliding commented 1 month ago

http访问的时候 服务器会发送一个跳转 这个跳转指向自己真实端口,https访问的时候 服务器没有发现问题 所以会正常通信,不知道你自己的站是用什么搭的 你可能需要自己正确设置30x重定向的目标

laperuz92 commented 1 month ago

I think something wrong with your apache/nginx config.

Here is an example from my nginx config, the main thing is the last line. You are redirecting http to https, not mentioning port.

server { listen 80 default_server; listen [::]:80 default_server; server_name mysite.com www.mysite.com; return 301 https://$host$request_uri; }

maryjeck commented 1 month ago

我用的是caddy,http时指向https:443端口,也就是xray的入口

redir https://xxxxx.com{uri} permanent