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

The TZ of WS+TLS in normal use has some problems.

The error message is as follows:

[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]

The answer on the Internet says that you can restore it by turning off SELinux.
But I remember that SELinux on the server was turned off a long time ago.

But at first glance, hey, it's strange, SELinux status is open.
How to close: https://blog.51cto.com/bguncle/957315

However, after closing, this error still occurs.

The online answers rarely encounter this problem.
Then you can only analyze it yourself.

The first thing is to check the log.

  • V2ray's log:
    • /var/log/v2ray/error.log
    • /var/log/v2ray/access.log
  • Nginx log
    • nginx-error.log

However, after checking, it was found that there was no error message in v2. Error log full of 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”

A simple analysis is that when connecting to an upstream service, the connection is rejected.

At this point, it is basically clear.
The truth is:

The server restarted abnormally, and the Nginx service started by itself. However, V2 did not start by itself. Cause Connection refused while connecting to upstream.

In fact, I should have thought of it when I discovered that SElinux started by itself.

So restart v2.

systemctl start v2ray

Guess you like

Origin blog.csdn.net/xiaohaigary/article/details/115310280