failed to handler mux client connection..502 Bad Gateway > websocket:bad handshake

正常使用的WS+TLS的TZ莫名出现问题。

错误信息如下:

[Warning] failed to handler mux client connection > v2ray.com/core/proxy/vmess/outbound: failed to find an available destination > v2ray.com/core/common/retry: [v2ray.com/core/transport/internet/websocket: failed to dial WebSocket > v2ray.com/core/transport/internet/websocket: failed to dial to (wss://vps.xxx.XX/7c6x7): 502 Bad Gateway > websocket: bad handshake] > v2ray.com/core/common/retry: all retry attempts failed
2021/03/29 16:33:10 tcp:127.0.0.1:1237 accepted tcp:www.google.com:443 [proxy]

网上的解答有说 关闭SELinux即可恢复。
但是我记得当初服务器上的SELinux早就关掉了呀。

不过一看,哎,好奇怪,SELinux状态是打开着的。
关闭方法:https://blog.51cto.com/bguncle/957315

然而关闭后,仍然出现这个错误。

那网上的解答很少有碰到这个问题的。
那就只能自己动手分析咯。

首先肯定是查看日志。

  • V2ray的日志:
    • /var/log/v2ray/error.log
    • /var/log/v2ray/access.log
  • Nginx日志
    • nginx-error.log

然而检查后,发现v2里面竟然没有一条错误信息。Nginx里面满满的错误日志:

[error] 21235#21235: *17820 connect() failed (111: Connection refused) while connecting to upstream, client: 113.111.16.60, server: xx.xx.xx, request: “GET /helloworld HTTP/1.1”, upstream: “http://127.0.0.1:42348/helloworld”, host: “xx.xx.xx”

简单分析,就是在连接上游服务的时候,连接被拒绝了。

到这里,基本就很清楚了。
真相就是:

服务器异常重启了,Nginx服务自己启动了。然而V2没有自己启动。导致Connection refused while connecting to upstream。

其实在发现SElinux自己启动了,就应该想到了的。

因此重启v2即可。

systemctl start v2ray

猜你喜欢

转载自blog.csdn.net/xiaohaigary/article/details/115310280