- Newest
- Most votes
- Most comments
That means the ALB is either unable to connect to the target or that the target disconnected the connection the ALB used to send the request to it.
Did you set the target group that the HTTPS listener rule is using to send traffic to the targets to use HTTP or HTTPS? If it's HTTPS, is the target listening on the same port number, usually 443, that the target group is set to use? A typical way to configure load balancing for a website is to have the ALB receive the TLS-encrypted HTTPS connections from users, and for the ALB to connect to the target web server over unencrypted HTTP over the port 80.
If the target server is only listening on the HTTP port 80 and the ALB is trying to establish a TLS-encrypted HTTPS connection with it over the port 443, the attempt would fail and the ALB would return a 502 error.
Another similar problem would result if the web server was listening on the HTTPS port 443, and the target group is configured to use the target port 443, but the target group is set to use the HTTP protocol instead of HTTPS. The ALB would try to send a cleartext HTTP request to the TLS-encrypted listener port on the server, which would fail and cause the 502 error.
The screenshots show the Test instance specified as an HTTPS target on the target port 443. Does the server have a web server using the HTTP/1.1 protocol version and listening on the TLS port 443 (and not unencrypted HTTP) on the IPv4 address set as the primary for the EC2 instance?
Is the security group attached to the web server allowing inbound tcp/443 from the security group ID of the ALB or, for example, from all IPv4 source IPs (0.0.0.0/0) or those of the VPC?
Test (Target Group) > https://snipboard.io/MNGAfj.jpg
Relevant content
asked 2 years ago
asked 3 years ago
- AWS OFFICIALUpdated 4 months ago

I've included images for reference.