WSS Error in Safari >> failed: Unexpected response code: 401

I’ve tried both Flexible and Strict settings for TLS termination and I’ve tried setting minimum TLS version to 1.2 and 1.0 but at all times I get the following error in Safari not on HTTPS but only on WSS which is an upgraded HTTPS connection for Secure WebSocket.

Websocket connection to … failed: Unexpected response code: 401

I do have a worker script that enforces HTTP basic auth but that should be out of the way at that point since I can already view the app via HTTPS

I’m suspecting the worker maybe getting in the way because of the “401” error code. But If I’m able to view the HTTPS content already (after going thru the HTTP basic auth and entering username and password) then why would the Upgrade from HTTPS to Secure WebSocket result in 401?

I can’t share site details since it’s private at the moment, but I can try different things if anyone has any suggestions. The site in question is on the Free plan. I plan to upgrade it but I want to make sure it works first.


I think it’s a bug in how Workers interact with Websockets and it only happens in Safari.

Where should I report it?

Hi @mpexp2020, probably best to route it through support with the steps to reproduce. They’ll veryify and be able to route it on appropriately. Thank you!

To contact Cloudflare Customer Support, login & go to and select get more help. If you receive an automatic response that does not help you, please reply and indicate you need more help.