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: - - [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: - - [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,

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.

@nicgayerie: I did some more investigation and it turns out the problematic requests are also missing the “Upgrade: websocket” http header that’s why my backend cannot handle them. Is there anything I can log on my side that could help us get to the bottom of this?

This is one of the failing requests with CF-Ray and CF-Request-ID headers:

213.XXX.XXX.XXX - - [28/Sep/2020:12:54:01 +0200] "GET /websocket?resourceName=%2Fwebsockets%2Fnotifications&connectionToken=428cb85d-XXX-XXX-XXX-XXXXXX" HTTP/2.0" 404 4672 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15" "-" "-" "5d9cec8d3b181fe6-AMS" "0575f22c3e00001fe692067200000001"

CF-Ray “5d9cec8d3b181fe6-AMS”
CF-Request-ID “0575f22c3e00001fe692067200000001”

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.