Websocket继续响应“ 403 Forbidden”。尽管所有标题都是正确的
好吧,我试图连接到此Websocket ws ws://rustypot.com/socket.io/?eio = 4& transport = websocket,但继续遇到403 forbidend Forry错误。我尝试使用我的Nodejs后端和邮递员进行连接,结果相同。 因此,当您遇到这样的问题时,您应该做的第一件事是检查标题,我做到了。我所有的标题都很好:
Error: Unexpected server response: 403
Handshake Details
Request URL: https://rustypot.com/socket.io/?EIO=4&transport=websocket
Request Method: GET
Status Code: 403 Forbidden
Request Headers
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: HeibSZt/sW4ivlyCkdN87g==
Connection: Upgrade
Upgrade: websocket
Origin: https://rustypot.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
Host: rustypot.com
Response Headers
Date: Sun, 26 Jun 2022 14:48:11 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: close
CF-Chl-Bypass: 1
Permissions-Policy: accelerometer=(),autoplay=(),camera=(),clipboard-read=(),clipboard-write=(),fullscreen=(),geolocation=(),gyroscope=(),hid=(),interest-cohort=(),magnetometer=(),microphone=(),payment=(),publickey-credentials-get=(),screen-wake-lock=(),serial=(),sync-xhr=(),usb=()
Cache-Control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Expires: Thu, 01 Jan 1970 00:00:01 GMT
X-Frame-Options: SAMEORIGIN
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
CF-RAY: 7216be129b0484b0-LED
但是,如果我尝试通过一些Chrome扩展程序连接到同一该死的Websocket,则可以正常工作:
任何帮助都将不胜感激。 Cloudflare在踢我的屁股吗?我很困惑
Well, I am trying to connect to this websocket ws://rustypot.com/socket.io/?EIO=4&transport=websocket but keep getting 403 forbidden error. I tried both connecting using my NodeJS backend and Postman with the same result.
So, when you encounter such a problem, the first thing you're supposed to do is to check the headers and I did. All my headers are fine:
Error: Unexpected server response: 403
Handshake Details
Request URL: https://rustypot.com/socket.io/?EIO=4&transport=websocket
Request Method: GET
Status Code: 403 Forbidden
Request Headers
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: HeibSZt/sW4ivlyCkdN87g==
Connection: Upgrade
Upgrade: websocket
Origin: https://rustypot.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
Host: rustypot.com
Response Headers
Date: Sun, 26 Jun 2022 14:48:11 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: close
CF-Chl-Bypass: 1
Permissions-Policy: accelerometer=(),autoplay=(),camera=(),clipboard-read=(),clipboard-write=(),fullscreen=(),geolocation=(),gyroscope=(),hid=(),interest-cohort=(),magnetometer=(),microphone=(),payment=(),publickey-credentials-get=(),screen-wake-lock=(),serial=(),sync-xhr=(),usb=()
Cache-Control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Expires: Thu, 01 Jan 1970 00:00:01 GMT
X-Frame-Options: SAMEORIGIN
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
CF-RAY: 7216be129b0484b0-LED
BUT if I try to connect to the same damn websocket via some chrome extension it works fine:
Any help would be much appreciated. Is Cloudflare kicking my ass? I'm so confused
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论