使用 AWS 和 Elastic Beanstalk 的 Websocket

编程入门 行业动态 更新时间:2024-10-27 17:15:22
本文介绍了使用 AWS 和 Elastic Beanstalk 的 Websocket的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试让我的 websockets 与 Amazon Web Service 和 Elastic Beanstalk (ELB) 一起工作.

I'm trying to get my websockets working with Amazon Web Service and Elastic Beanstalk (ELB).

我根据以下设置了代理协议:docs.aws.amazon/ElasticLoadBalancing/latest/DeveloperGuide/启用代理协议.html

I set up a proxy protocol according to: docs.aws.amazon/ElasticLoadBalancing/latest/DeveloperGuide/enable-proxy-protocol.html

我已针对所有 IP 在所有端口上向负载均衡器和其他安全组开放所有入站流量.

I've opened up all inbound traffic to my load balancer and other security groups on all ports, for all IPs.

我还在端口 80 上将负载平衡器侦听器保留为 HTTP.

I also kept the load balancer listerner as HTTP on port 80.

我的 websocket 连接在尝试连接 80 端口时出现以下错误:失败:WebSocket 握手期间出错:意外响应代码:400

My websocket connection gives the following error when trying to connect on port 80: failed: Error during WebSocket handshake: Unexpected response code: 400

在端口 8080 上出现此错误:失败:连接建立错误:net::ERR_CONNECTION_REFUSED

And this error on port 8080: failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

希望得到建议,我在这一点上被卡住了.

Would appreciate suggestions, I'm stuck at this point.

谢谢!

推荐答案

配置 EC2 安全组后,您的应用程序将使用公共 IP.

After configuring EC2 Security group your application will work with public IP.

但是您仍然会遇到使用 EB URL 的问题.要解决此问题,您必须更改 EB 配置.

But you still will get issue with using EB URL. To solve this issue, you have to change EB configuration.

  • 进入EB环境页面
  • 配置
  • 在负载平衡部分,将协议从 HTTP 更改为 TCP.
  • 现在您可以点击 EB URL.

    Now you can click EB URL.

    更多推荐

    使用 AWS 和 Elastic Beanstalk 的 Websocket

    本文发布于:2023-11-15 07:53:22,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1592555.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:Elastic   AWS   Websocket   Beanstalk

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!