502 & Keepalive connection closed, AWS/CloudFront + classic LB + Kong (K8s)

An HTTP 502 error means that a server received an invalid response from another server. In this case, Kong received an invalid response from your upstream. It is all explained in the log really: upstream prematurely closed connection while reading response headers. Your upstream prematurely closed the connection while Kong was patiently expecting its response.

In order to resolve this, you will have to investigate this from the upstream, see if any errors occurred there (since the issue arises with POST requests, is there a hard limit on payload sizes being met somewhere maybe?), and if not, then capturing the traffic to understand exactly what is going on will be required. This is similarly investigated as an upstream connection reset error for example.