- Newest
- Most votes
- Most comments
Based on your setup and the issues you're facing, let me address each problem:
Issue 1: WebSocket not working through NLB For WebSocket connections over TCP through an NLB, there are several potential causes:
- Check that your security groups allow the WebSocket traffic on the required ports
- Ensure the NLB target group health checks are properly configured
- Verify that the NLB is correctly forwarding traffic to your instances
- Confirm your WebSocket protocol implementation is compatible with the NLB's TCP handling
Issue 2: DNS configuration for HTTPS through ALB When using an ALB for HTTPS traffic, you need to ensure proper DNS configuration:
- Your domain should point to the appropriate load balancer for each service
- For the HTTPS traffic, create DNS records (like CNAME records) pointing to your ALB's DNS name
- For WebSocket/PUSH traffic, create separate DNS records pointing to your NLB
For a proper architecture with both HTTPS and WebSocket support:
- Use an ALB with HTTPS listeners for your secure HTTP traffic
- Use an NLB with TCP listeners for your WebSocket/PUSH traffic
- Configure your DNS with appropriate records for each service (e.g., main domain to ALB, websocket subdomain to NLB)
- Ensure your application is configured to use the correct endpoints for each type of traffic
If you're using a combined NLB-to-ALB architecture (NLB in front of ALB), note that when configuring an ALB as the target of an NLB, the NLB must use a TCP listener (not TLS). The ALB would then handle the HTTPS termination.
Sources
HTTPS and PUSH streaming | AWS re:Post
Using HTTPS with an NLB communicating securely via an ALB to the EC2 | AWS re:Post
EC2 accessed by an NLB via ALB | AWS re:Post
How to setup the NLB -> ALB architecture properly to have a Beanstalk application accessible from the internet? | AWS re:Post
answered a year ago
Issue1: Websockets stops working when you implement NLB:
Please note that WebSockets relies on the HTTP Upgrade mechanism. As you may know NLBs, by default, do not handle HTTP traffic. NLBs are designed for TCP/IP-based protocols and are transparent to upper layer protocols like HTTP. My recommendation would be to use ALB which supports websockets or configure NLB target to handle websocket upgrades.
Issue2: Setting domain to point to ALB. Could you elaborate further on this? Do you mean you have a custom domain pointing to instance and you would like to point it to ALB? If so, you may use an A record and point the domain name to the ALB. During the change, ensure the ALB has a healthy target and you are able to access it from the same clients that are accessing the instance. You may then make the changes in Route 53 to point the domain to the ALB.
Please confirm if these are your requirements. You may share additional information if the above does not address your queries.
answered a year ago
Relevant content
asked 3 years ago
asked 3 years ago
