Description
I didn't find much online about this, but when connecting through cloudflare to a tornado WebSocket handler I received these headers:
Host: dataframe.vaex.io
X-Real-Ip: 141.101.105.77
X-Forwarded-For: 89.188.19.102, 141.101.105.77
Connection: upgrade
Accept-Encoding: gzip
Cf-Ipcountry: NL
Cf-Ray: 5afa07af2b3cbd82-AMS
X-Forwarded-Proto: https
Cf-Visitor: {"scheme":"https"}
User-Agent: curl/7.68.0
Accept: */*
Origin: http://dataframe.vaex.io
Cf-Request-Id: 03d02321780000bd82a2118200000001
Cf-Connecting-Ip: 89.188.19.102
Cdn-Loop: cloudflare
After which you get the error Connection" must be "Upgrade"
. The stacktrace in tornado is pretty vague (self.client is None at
tornado/tornado/simple_httpclient.py
Line 658 in ad6e4ac
But using curl helped:
$ curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: dataframe.vaex.io" -H "Origin: http://dataframe.vaex.io" https://dataframe.vaex.io/websocket
Note the https
https://community.cloudflare.com/t/websocket-pass-through-crashes-worker-script/78482/7 gave me a hint to disable http2:
$ curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: dataframe.vaex.io" -H "Origin: http://dataframe.vaex.io" https://dataframe.vaex.io/websocket --http1.1
This worked 🎉
I didn't see an option to choose the HTTP version in tornado, so i disabled https in cloudflare, and I now don't have an issue.
Sorry for the low quality hasty, report. I am in a hurry, but it might be useful for the author(s) or someone with similar issues.