Skip to content

FallbackObject 中的 "xver" 参数失效 #4963

@r06ertray

Description

@r06ertray

完整性要求

  • 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
  • 我提供了完整的配置文件和日志,而不是出于自己的判断只给出截取的部分。
  • 我搜索了 issues, 没有发现已提出的类似问题。
  • 问题在 Release 最新的版本上可以成功复现

描述

Xray-core v25.7.23 及以后版本中, FallbackObject 中的 "xver" 参数失效。

重现方式

1、服务端 Xray 配置文件


{
    "log": {
        "loglevel": "debug",
        "access": "/dev/shm/xray.log",
        "error": "/dev/shm/xray.log"
    },
    "inbounds": [
        {
            "port": 8443,
            "protocol": "vless",
            "settings": {
                "clients": [
                    {
                        "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
                        "flow": "xtls-rprx-vision"
                    }
                ],
                "decryption": "none",
                "fallbacks": [
                    {
                        "dest": 8080,
                        "xver": 1
                    }
                ]
            },
            "streamSettings": {
                "network": "tcp",
                "security": "tls",
                "tlsSettings": {
                    "rejectUnknownSni": true,
                    "alpn": [
                        "http/1.1"
                    ],
                    "certificates": [
                        ...
                    ]
                }
            }
        }
    ]
}

2、服务端 Caddy 配置文件


{
    servers :8080 {
        protocols h1
        listener_wrappers {
            proxy_protocol {
                allow 127.0.0.1/32
            }
        }
    }
}

:8080 {
    log {
        output file /dev/shm/caddy.log
    }
    respond /online "ok"
}

3、使用 curl 访问 Xray 监听的 8443 端口,该请求会回落到 Caddy 监听的 8080 端口上


curl https://your.domain.com:8443/online

结果对比

- 当 Xray-core 版本 <= v25.6.8,Caddy 日志


{
    "level": "info",
    "ts": 1753887134.776431,
    "logger": "http.log.access.log0",
    "msg": "handled request",
    "request": {
        "remote_ip": "213.2.1.3", /* 获取到正常的远程 IP */
        "remote_port": "48945",
        "client_ip": "213.2.1.3", /* 获取到正常的客户端 IP */
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "******:8443",
        "uri": "/online",
        ...
    },
    ...
}

- 当 Xray-core 版本 >= v25.7.23,Caddy 日志


{
    "level": "info",
    "ts": 1753887225.3729845,
    "logger": "http.log.access.log0",
    "msg": "handled request",
    "request": {
        "remote_ip": "::1", /* ???????? */
        "remote_port": "42000",
        "client_ip": "::1", /* ???????? */
        "proto": "HTTP/1.1",
        "method": "GET",
        "host": "******:8443",
        "uri": "/online",
        ...
    },
    ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions