WebSockets: wss from client to Amazon AWS EC2 instance through ELB

前端 未结 2 920
清歌不尽
清歌不尽 2021-02-02 14:18

How can I connect over ssl to a websocket served by GlassFish on an Amazon AWS EC2 instance through an ELB?

I am using Tyrus 1.8.1 in GlassFish 4.1 b13 pre-release as my

2条回答
  •  误落风尘
    2021-02-02 14:44

    I recently enabled wss between my browser and an EC2 Node.js instance. There were 2 things to consider:

    • in the ELB listeners tab, add a row for the wss port with SSL as load balancer protocol.
    • in the ELB description tab, set an higher idle timeout (connection settings), which is 60 sec by default. The ELB was killing the websocket connections after 1 minute, setting the idle timeout to 3600 (the max value) enables much longer communication.

    It is obviously not the ultimate solution since the timeout is still there, but 1 hour is probably good enough for what we usually do.

    hope this help

提交回复
热议问题