zoraxy icon indicating copy to clipboard operation
zoraxy copied to clipboard

[BUG] BAD HANDSHAKE

Open barto95100 opened this issue 2 years ago • 4 comments

I received most of this line in logs: 2023/12/31 13:25:19 websocketproxy: couldn't dial to remote backend url websocket: bad handshake

and I don't know why ....?

do you have idea or tips to show why this log show

barto95100 avatar Dec 31 '23 13:12 barto95100

@barto95100 I am guessing you have another reverse proxy sits between Zoraxy and the web server that handle websocket request, in which the reverse proxy override some of the critical headers (usually the Upgrade header, but it might be some other headers). Please ensure that your reverse proxy configuration do not override/remove headers.

If you need further help, please provide a more detailed bug report with reproduction steps and full log output from the backend in which Zoraxy is trying to connects.

tobychui avatar Jan 01 '24 13:01 tobychui

@tobychui Zoraxy is the front and send to back authentik for some domain but not all, I don't know what the backend is this log

How i configure debug in zoraxy log to view what's the backend probleme to have this log handshake ?

barto95100 avatar Jan 01 '24 17:01 barto95100

@tobychui I want to add to this as my log files are overflowing with this error. every couple of seconds to every 5 mins.

websocketproxy: couldn't dial to remote backend url websocket: bad handshake

Ive checked every service/proxy host, Disabled each one at a time and even disabled all of them yet it still persists.
I am running zoraxy as a docker image and this is the docker logs as i have consoled into the instance and checked log file in /opt/zorarxy/config/log and websocket errors do not log to that file.

other websocket errors log to stdout (but still not the zoraxy log) and at least show a destination ip/port. as @barto95100 noted is there away to enable more verbosity for the websock logging?

AzAel76 avatar Jun 29 '24 07:06 AzAel76

@AzAel76 From what I know, the bad handshake error was not raised from the code base of Zoraxy. I guess it is from much lower level (gorilla websocket I guess) and there isn't any more "verbal" I can provide except the error message report from lower level of abstractions.

https://github.com/tobychui/zoraxy/blob/745a54605f0e84d04bc460218a0a6635bbd78772/src/mod/websocketproxy/websocketproxy.go#L161

Though, I think I can modify the websocket proxy handler to write the information into the zoraxy log file with origin requests info (e.g. downstream / upstream ips). I will see how can I improve it after I am done with the load balancer. Meanwhile, if you have any ideas, feel free to try modifying the above file and see if you can discover anything new.

tobychui avatar Jun 29 '24 07:06 tobychui