destination > common/retry: [transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://cw.fjh1997.top/): 200 OK > websocket: bad handshake] > common/retry: all retry attempts failed
开发的时候遇到这个问题,奈何浏览器抓不了websocket的握手包,正常握手包是101状态码的http数据包,但是实际上返回了200状态码的数据包。试了下wscat也不行,看来只能用大名鼎鼎的burpsuite了。
抓包显示,
Error: To use the new ReadableStream() constructor, enable the
streams_enable_constructors compatibility flag. Refer to the docs for
more information:
https://developers.cloudflare.com/workers/platform/compatibility-dates/#compatibility-flags
由于我用了new ReadableStream()这个函数,所以需要设置flag,而根据上述文档,该flag只有通过wrangler部署,使用网页面板不行。
之后在wrangler.toml里面添加compatibility_date = "2023-12-01"
部署即可。大概日期随便填吧。