v2ray / v2ray-core

A platform for building proxies to bypass network restrictions.
https://www.v2ray.com/
MIT License
45.28k stars 8.94k forks source link

token not found in 'Upgrade' header #1156

Closed Lua12138 closed 5 years ago

Lua12138 commented 6 years ago

Please skip to the English section below if you don't write Chinese.

中文: 提交 Issue 之前请先阅读 Issue 指引,然后回答下面的问题,谢谢。 除非特殊情况,请完整填写所有问题。不按模板发的 issue 将直接被关闭。

1) 你正在使用哪个版本的 V2Ray?(如果服务器和客户端使用了不同版本,请注明)

2) 你的使用场景是什么?比如使用 Chrome 通过 Socks/VMess 代理观看 YouTube 视频。

Chrome 使用

3) 你看到的不正常的现象是什么?(请描述具体现象,比如访问超时,TLS 证书错误等)

客户端日志提示:

2018/06/23 16:51:53 [Info] [347495865] App|Proxyman|Inbound: connection ends > Proxy|Socks: connection ends > Proxy|Socks: failed to transport all TCP response > io: read/write on closed pipe
2018/06/23 16:51:53 [Warning] [2355788521] App|Proxyman|Outbound: failed to process outbound traffic > Proxy|VMess|Outbound: failed to find an available destination > Retry: [Transport|Internet|WebSocket: failed to dial WebSocket > Transport|Internet|WebSocket: failed to dial to (wss://my.domain/ray): 400 Bad Request > websocket: bad handshake] > Retry: all retry attempts failed

服务端日志提示:

Transport|Internet |WebSocket: failed to convert to WebSocket connection > websocket: the client is not using the websocket protocol: 'websocket' token not found in 'Upgrade' header

服务端NGINX日志与客户端提示基本一致,返回HTTP状态码为400

4) 你期待看到的正确表现是怎样的?

能够正常使用

5) 请附上你的配置(提交 Issue 前请隐藏服务器端IP地址)。

服务器端配置:

{
  "log": {
    "loglevel": "info"
  },
  "inbound": {
    "port": 2046,
    "listen":"0.0.0.0",
    "protocol": "vmess",
    "settings": {
      "clients": [
        {
          "id": "b831381d-6324-4d53-ad4f-8cda48b30811",
          "alterId": 64
        }
      ]
    },
    "streamSettings": {
      "network": "ws",
      "wsSettings": {
      "path": "/ray"
      }
    }
  },
  "outbound": {
    "protocol": "freedom",
    "settings": {}
  }
}
客户端配置:
{
  "log": {
    "loglevel": "debug"
  },
  "dns": {
    "servers": [
      "1.2.4.8"
    ]
  },
  "inbound": {
    "port": 1080,
    "listen": "0.0.0.0",
    "protocol": "socks",
    "domainOverride": [
      "tls",
      "http"
    ],
    "settings": {
      "auth": "noauth",
      "udp": false
    }
  },
  "outbound": {
    "protocol": "vmess",
    "settings": {
      "vnext": [
        {
          "address": "my.domain",
          "port": 443,
          "users": [
            {
              "id": "b831381d-6324-4d53-ad4f-8cda48b30811",
              "alterId": 64
            }
          ]
        }
      ]
    },
    "streamSettings": {
      "network": "ws",
      "security": "tls",
      "wsSettings": {
        "path": "/ray"
      },
      "tlsSeettings": {
        "serverName": "my.domain",
        "allowInsecure": false
      }
    }
  }
}

NGINX 配置信息

server {
  listen 443 ssl;
  server_name my.domain;
  ssl_certificate my.cert.url;
  ssl_certificate_key my.cret.key.url;

  location /ray {
        proxy_pass http://docker_ip:port
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_read_timeout 86400;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $http_host;
  }
}
kslr commented 5 years ago

I’m closing this issue because it has been inactive for a few months. This probably means that it is not reproducible or it has been fixed in a newer version. If it’s an enhancement and hasn’t been taken on for so long, then it seems no one has the time to implement this.

Please reopen if you still encounter this issue with the latest stable version. You can also contribute directly by providing a patch – see the developer manual. :)

Thank you!