websocket request to durable object does not contain upgrade header
I have a weird issue.
I deployed a project using durable objects to
namespace.name.workers.dev
and setup a worker route to a domain (ie. example.com
)
Everything works fine on the workers.dev domain, but when trying to connect to example.com
it doesn't work with the error below. I've confirmed the browser is sending the header, but it's not being received by the fetch handler.
Worker tried to return a WebSocket in a response to a request which did not contain the header "Upgrade: websocket"."
does anyone know why this isnt working?6 Replies
In your website in Cloudflare, check under the "Network" tab if Websockets are enabled. Without websockets being enabled in CF, it strips the header.
works perfectly, thank you! did I miss this in the docs somewhere?
the network setting or what exactly? It's documented: https://developers.cloudflare.com/network/websockets/
Cloudflare Docs
WebSockets · Cloudflare Network settings docs
Cloudflare supports proxied WebSocket connections without additional configuration.
under the durable objects docs, I would have never found the option
oh idk, there's a few places in its docs where they are mentioned and the zone setting is only slightly related
sometimes hard to place those things/for docs writers to remember everything. If you think it makes sense to have it in the docs at a specific spot under durable objects, you can make an issue or pr the docs repo in github