Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V5 格式配置 ws.header 报错 #3012

Closed
nie11kun opened this issue May 10, 2024 · 2 comments
Closed

V5 格式配置 ws.header 报错 #3012

nie11kun opened this issue May 10, 2024 · 2 comments

Comments

@nie11kun
Copy link

nie11kun commented May 10, 2024

你正在使用哪个版本的 V2Ray?

V5.16.1

你的使用场景是什么?

websocket stream 中配置 header 自定义头: "Host":"my.domain"

你看到的异常现象是什么?

配置后 test 测试不通过.

你期待看到的正常表现是怎样的?

V4 版本配置文件能够正常配置运行。

请附上你的配置

服务端配置:

客户端配置:

    {
            "protocol": "vless",
            "settings": {
                "address": "1.2.3.4",
                "port": 443,
                "uuid": "uuid"
            },
            "tag": "out-vless",
            "streamSettings": {
                "transport": "ws",
                "transportSettings": {
                    "path": "/proxypath",
                    "header": [
                        {
                            "Host": "proxy.host.xyz"
                        }
                    ],
                    "maxEarlyData": 2048,
                    "useBrowserForwarding": false
                },
                "security": "tls",
                "securitySettings": {
                    "serverName": "proxy.host.xyz",
                }
            }
        }

请附上出错时软件输出的错误日志

服务器端错误日志:

客户端错误日志:

PS C:\v2ray> .\v2ray.exe test -c .\config.json -format jsonv5
V2Ray 5.16.1 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.22.2 windows/amd64)
A unified platform for anti-censorship.
Test failed: main/commands: failed to load config: [.\config.json] > infra/conf/v5cfg: unable to build config > infra/conf/v5cfg: unable to load transport config > common/registry: unable to parse json content > unknown field "Host" in v2ray.core.transport.internet.websocket.Header

请附上访问日志

其它相关的配置文件(如 Nginx)和相关日志

如果 V2Ray 无法启动,请附上 --test 命令的输出

PS C:\v2ray> .\v2ray.exe test -c .\config.json -format jsonv5
V2Ray 5.16.1 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.22.2 windows/amd64)
A unified platform for anti-censorship.
Test failed: main/commands: failed to load config: [.\config.json] > infra/conf/v5cfg: unable to build config > infra/conf/v5cfg: unable to load transport config > common/registry: unable to parse json content > unknown field "Host" in v2ray.core.transport.internet.websocket.Header

配置改为 v4 格式则正常通过测试:

{
      "tag": "proxy",
      "protocol": "vless",
      "settings": {
        "vnext": [
          {
            "address": "1.2.3.4",
            "port": 443,
            "users": [
              {
                "id": "UUID",
                "alterId": 0,
              }
            ]
          }
        ]
      },
      "streamSettings": {
        "network": "ws",
        "security": "tls",
        "tlsSettings": {
          "allowInsecure": false,
          "serverName": "proxy.host.xyz",
        },
        "wsSettings": {
          "path": "/proxypath",
          "headers": {
            "Host": "proxy.host.xyz"
          }
        }
      }
    }
@frankli0324
Copy link

frankli0324 commented May 10, 2024

header可以生效的格式是:

"header": [
    {
        "key": "Host",
        "value": "www.baidu.com"
    }
],

文档感觉很久没更新了。。。不确定是否符合预期

@nie11kun
Copy link
Author

header可以生效的格式是:

"header": [

    {

        "key": "Host",

        "value": "www.baidu.com"

    }

],

文档感觉很久没更新了。。。不确定是否符合预期

你的配置是正确的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants