websocket server host has to be blank in order to work on ec2 instance with application load balancer

一曲冷凌霜 提交于 2019-12-11 06:56:33

问题


I have an aws application load balancer with an https listener on port 9999, forwarding to a group on port 9999 with an ec2-instance being the target.

If I run my websocket server with the host name configured to my domain api.example.com, then when the client tries to open a websocket connection it gets:

Error during WebSocket handshake: Unexpected response code: 502

However, if I configure my websocket server with an empty string instead of the domain, then it connects just fine!

This is problematic because the server I am intending to run on this instance automatically launches a websocket server ONLY IF there is a websocket host name configuration provided, so a blank string means the websocket server will never launch! I would prefer to not have to hack the library to get around that condition. So I am wondering, why in the world a blank string works, but the domain name does not?

I tried localhost, the ip of the box, etc, everything results in a 502 except a blank string!

来源:https://stackoverflow.com/questions/51053863/websocket-server-host-has-to-be-blank-in-order-to-work-on-ec2-instance-with-appl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!