Our set up is we are using Elastic beanstalk for our django web app on AL2 (which gives nginx as a default reverse proxy out of the box). We are seeing multiple 502 on ALB during peak load and few 502 during non peak load. After deep diving issue we hypothesised that it can because of default nginx keep alive timeout so added nginx conf file.
client_header_timeout 360s;
client_body_timeout 360s;
keepalive_timeout 360s;
send_timeout 360s;
proxy_connect_timeout 360s;
proxy_send_timeout 360s;
proxy_read_timeout 360s;
client_max_body_size 5M;
However we still see 502s on the ALB. After deep diving into logs of EBS and ALB we realised that every 408 on the nginx is giving 502 on ALB. Below are the logs of ALB and nginx for the same request ALB:ALB log where target time is around 60s
EBSlog: Nginx log on EBS
We have increased the idle timeout to 80 sec still we got this 502. Is it possible that ELB idle timeout takes some time to get reflected or is there any other issue ?
Edit: Increasing idle time is not working and still gives a 502 because of the application/nginx 408