You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When connecting to a remote web socket server running on a custom port. Cloudflare worker will try to use port 80/443 instead of the one specified in the URL, resulting in the following error if the url path doesn't exist on port 80/443:
Error: Uncaught TypeError: Failed to establish the WebSocket connection: expected server to reply with HTTP status code 101 (switching protocols), but received 404 instead.
This behaviour only happen with deployed worker, so if you run wrangler dev, local mode will work fine, but once you turn off local mode, the error will happen.
Reproduction steps
Create a server with a web socket application listening on port 8182 at path /my-path
Also add a normal web application on port 80 & 443 at path /, any other http(s) request to different path will return 404
Observe that new WebSocket('wss://thedomain.com:8182/my-path') work correctly everywhere, but fail on a deployed worker, throwing 404 not found
The text was updated successfully, but these errors were encountered:
If I put the web socket application at port 80, 443 & 8182 then the socket connection to port 8182 work as expected. So it seems like Cloudflare worker will always go to the default port first and will error if the default port return 404, and then it will go to the port specified in the URL.
Behaviour
When connecting to a remote web socket server running on a custom port. Cloudflare worker will try to use port
80
/443
instead of the one specified in the URL, resulting in the following error if the url path doesn't exist on port80
/443
:This behaviour only happen with deployed worker, so if you run
wrangler dev
, local mode will work fine, but once you turn off local mode, the error will happen.Reproduction steps
8182
at path/my-path
80
&443
at path/
, any other http(s) request to different path will return404
new WebSocket('wss://thedomain.com:8182/my-path')
work correctly everywhere, but fail on a deployed worker, throwing404
not foundThe text was updated successfully, but these errors were encountered: