elb ssl 终止 wss websocket 失败 net::ERR_RESPONSE_HEADERS_TRUNCATED

elb ssl 终止 wss websocket 失败 net::ERR_RESPONSE_HEADERS_TRUNCATED

ELB我正在尝试通过具有 SSL 终端的经典方式与基于 Java 的媒体服务器 wowza建立 websocket 通信。

设置

VPC

R53
test.myTld.com 
IPv4, Alias=Yes, Target myElb, Routing Simple

CLASSIC ELB: myElb
listeners: SSL 64443 -> TCP 64443 : SSL Cert managed by AWS Certificate Manager (ACM)
security group [sg-xxxxx] : Custom TCP Rule TCP (6) 64443 0.0.0.0/0

EC2 
security group [sg-xxxxx] : Custom TCP Rule TCP (6) 64443 0.0.0.0/0

非 wss 流量按预期到达实例。当使用直接 IP 连接到 ec2 wowza 时,连接正常并且流连接

wss://xxx.xxx.xxx.xxx:64443/webrtc-session.json

Frames = {status: 200, statusDescription: "OK", direction: "publish", command: "sendOffer",…}

但是通过连接ELB我得到了不同的错误报告

WebSocket connection to 'wss://test.myTld.com:64443/webrtc-session.json' failed: Error during WebSocket handshake: net::ERR_RESPONSE_HEADERS_TRUNCATED

因此,请遵循以下几个教程和文档,例如AWS ELB CLI我添加了以下内容

aws elb create-load-balancer-policy --load-balancer-name myElb --policy-name wowza --policy-type-name ProxyProtocolPolicyType --policy-attributes AttributeName=ProxyProtocol,AttributeValue=True
aws elb set-load-balancer-policies-for-backend-server --load-balancer-name myElb --instance-port 64443 --policy-names wowza

确认政策已更新,

aws elb describe-load-balancers --load-balancer-name myElb
"VPCId": "vpc-xxxxxxxx", 
"BackendServerDescriptions": [
 {
   "InstancePort": 64443, 
   "PolicyNames": [
                   "wowza"
                  ]
                }
            ], 
            "Instances": [
                {
                    "InstanceId": "i-xxxxxxx"
                }
            ], 

test.myTld.com然后我尝试使用&进行连接ELB,第一次尝试报告

WebSocket connection to 'wss://test.myTld.com:64443/webrtc-session.json'
failed: Error during WebSocket handshake: Invalid status line

Frames = (Opcode -1)

然后后续尝试报告

WebSocket connection to 'wss://test.myTld.com:64443/webrtc-session.json'
failed: Error during WebSocket handshake: net::ERR_RESPONSE_HEADERS_TRUNCATED
Frames = (Opcode -1)

以下是来自 wowza 的日志

server  INFO    200 -   WebSocketSession.create[94728968]   -   -   -   9432.997
server  INFO    200 -   WebSocketSession.destroy[926674790]: source:server status:-1 description:Unknown    -   -   -   9490.999

所以我的问题是,我还需要设置什么才能让 ELB 传递wss标头来建立 websocket。

相关内容