Skip to content

HTTPS Target Group 502 Error

0

Hello,

I am in the process of setting up a dual-tier WordPress infrastructure. However, I'm encountering an issue with my HTTPS target group as it is returning a 502 Bad Gateway error regardless of using HTTP and HTTPS listeners. Any help with this issue?

To address this, I have configured my Application Load Balancer (ALB) with HTTP and HTTPS listeners.

The HTTP 80 listener is connected to the HTTP target group and is set up to redirect traffic to the HTTPS listener. The HTTPS 443 listener is connected to the same HTTP target group.

Additionally, all security groups, route tables, and subnets have been configured to allow traffic on both HTTP and HTTPS ports, as well as IPv4 and IPv6.

image1 2 3 4

2 Answers
2
Accepted Answer

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.

EXPERT

answered 2 years ago

EXPERT

reviewed 2 years ago

EXPERT

reviewed 2 years ago

EXPERT

reviewed 2 years ago

0

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?

EXPERT

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.