Frequent Websocket connection errors

The last couple of days we have seen increased websocket connection errors. At first there were a couple of dozen errors a day, now we are in the thousands. We did not make any changes to our Cloudflare configuration and our setup has been working perfectly for months.

We are on a free account but definitely well below any of the free tier limits. Even our domains that hardly see any traffic exhibit this problem.

When I compare a failed connection attempt to a valid one in the Nginx request logs, I can see that the failed once arrive via “HTTP/2.0”.

This is a working request:

89.xxx.xxx.xxx - - [15/Sep/2020:15:26:41 +0200] "GET /websocket?resourceName=%2Fwebsockets%2Fnotifications&connectionToken=5f590e01-539a-4393-b25b-xxxxxxxx HTTP/1.1" 101 397 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Safari/605.1.15"

This is one of the requests coming in with HTTP/2.0:

89.xxx.xxx.xxx - - [15/Sep/2020:15:26:05 +0200] "GET /websocket?resourceName=%2Fwebsockets%2Fnotifications&connectionToken=5f590e01-539a-4393-b25b-xxxxxxxx HTTP/2.0" 404 4788 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Safari/605.1.15"

This seems to happen randomly. If I refresh my browser tab often enough, one of the requests will arrive with HTTP/2.0 and fail.

The problem does not exist if I circumvent CloudFlare and access my host directly,

Hello,
It seems that your origin returned a 404 for the request that failed here.
For the other one a 101 was returned, as expected.
I would recommend you to investigate further on the origin side, to check why the 404 was returned in this case.

Hi @nicgayerie. Thanks for your reply.

The 404 happens because my backend does not recognize these requests as websocket requests. In my opinion this not the cause of the problem but the symptom.

Is it possible that Cloudflare delivers a fraction of websocket connection requests as HTTP/2.0? As I said in my original post, this issue goes away immediately if I remove Cloudflare and access my host directly.

I can try to log the whole request including headers for the problematic requests.