We experienced a situation where if the gateway response payload is over 3-4 MB, the load balancer in AWS cloud returns a 502 and after capturing a tcpdump it shows that the client received RST packet to closes the connection.
Release : 10.1 with AWS application load balance.
The application load balance provided by AWS has header size limit, when the message header size exceeded, it returns 502 error.
As per AWS, it has limitations on headers [ in case of application load balancer ]
1. Modify the header to reduce the header size if possible.
2. Use other classic load balancer instead of AWS application load balancer.
Link for the AWS Application Load Balancer's limits:
https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-limits.html