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
開(kāi)發(fā)的時(shí)候遇到這個(gè)問(wèn)題,奈何瀏覽器抓不了websocket的握手包,正常握手包是101狀態(tài)碼的http數(shù)據(jù)包,但是實(shí)際上返回了200狀態(tài)碼的數(shù)據(jù)包。試了下wscat也不行,看來(lái)只能用大名鼎鼎的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()這個(gè)函數(shù),所以需要設(shè)置flag,而根據(jù)上述文檔,該flag只有通過(guò)wrangler部署,使用網(wǎng)頁(yè)面板不行。文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-839919.html
之后在wrangler.toml里面添加compatibility_date = "2023-12-01"
部署即可。大概日期隨便填吧。文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-839919.html
到了這里,關(guān)于解決cloudflare worker遇到failed to dial to (wss://): 200 OK > websocket: bad handshake 的問(wèn)題的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!