ELB Returns 502

0

Hi,
I have a private EC2 instance that sits behind an internal ELB (single instance at the moment). The software runs in Wildfly 11.
Target group shows it healthy. And I can use curl using ip address from another instance in a different vpc.
I also have a separate private instance (with a index.html on apache) and an internal ELB that has no problem with curling ELB DNS.
But it returns 502 when I curl the ELB dns name. Any idea where to look at?

Access log entry,
http 2019-11-11T22:57:04.899824Z app/DummyELB-2/b71c4db727f11413 172.31.14.179:60746 10.1.4.217:80 -1 -1 -1 502 - 127 293 "GET http://internal-dummyelb-2-1122730003.ap-southeast-2.elb.amazonaws.com:80/ HTTP/1.1" "curl/7.61.1" - - arn:aws:elasticloadbalancing:ap-southeast-2:xxx:targetgroup/DummyTG-2/738f12f02eeddb57 "Root=1-5dc9e740-f43a035fdc04fec2373217d6" "-" "-" 0 2019-11-11T22:57:04.898000Z "forward" "-" "-" "10.1.4.217:80" "-"

Thanks

Edited by: mumbo on Nov 11, 2019 6:25 PM

mumbo
asked 4 years ago422 views
2 Answers
0

Hi Hlulanib,

Well I thought it the same.

But turned out to be a problem with how I setup forwarding requests to port 8080 in the target group. I have set the override port to 8080 in the health check rather than in target group.

mumbo
answered 4 years ago
  • Hi Mumbo, I tried doing this. Keeping only the health check default port as the same, but seems to still give the same issue. Can you explain what you mean by the target group port ?

0

Hi

502 is an HTTP error that indicates that the load balancer was unable to parse the response sent from the registered instances.

Looking at the access log entry you provided I see that the processing time values is set to -1 -1 -1 this happens if load balancer cant can’t dispatch the request to a registered instance. This can happen if the registered instances closes the connection before the idle timeout or if the client sends a malformed request. The value can also be set to -1 if the registered instance does not respond before the idle timeout.

Backend instance could have closed the connection with a TCP RST or a TCP FIN while the load balancer had more request for the instance <<< so make sure the keep alive duration of the instance is shorter than the idle timeout value of the load balancer, making the keep alive duration of the load balancer greater than the instance, to ensure that the load balancer is responsible for closing the connection with your instance.

 Idle timeout range is from 1 to 4,000 seconds.

Application Load Balancer idle timeout setting: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/application-load-balancers.html#connection-idle-timeout

Classic Load Balancer Idle timeout setting: https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/config-idle-timeout.html

hope this helps.

Thank you
Hlulanib

answered 4 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.

Guidelines for Answering Questions