Configure WebSocket Support
You can configure an ALB to support WebSockets, a communication protocol that provides full-duplex communication channels over a single TCP connection.
To configure WebSocket support follow these steps:
ALB Setup. You can either set up the ALB using the ALB Setup or the following
POST
request.
Create a Target Group.
Before setting up an ALB, predefine a target group to distribute the incoming traffic to the correct target. An IP address and a port are used to register a target.
Ensure that no HTTP health check is configured for the target group for WebSocket support. Otherwise the ALB targets will be unavailable for load balancing. TCP health checks, i.e. healthCheckEnabled, are allowed.
You can either create target group using the Create a Target Group or the following
POST
request.
Create a Forwarding Rule.
Forwarding rules define how client traffic is distributed to the targets. More than one rule can be created for the same load balancer.
You can add forwarding rules using Add Forwarding rules guide.
Forwarding rule example:
Note: Web Socket traffic is not normal HTTP traffic, so ensure that your HTTP rules or conditions are accurate. Only the initial protocol upgrade to enable Web Socket tunneling can be targeted by the HTTP rule conditions. An example of this would be:
Result: This should result in an ALB that is able to handle HTTP protocol upgrade requests to switch to Web Socket tunneling.
Last updated