问题
I use AWS: ELB (classic) → EC2 (with Node.js)
Problem. Sometimes some requests return 502 Bad Gateway error. In Nginx error log a I see "upstream prematurely closed connection while reading response header from upstream" error.
Not timeout issue. This error happens the same second this request in handled by Node.js application. So it is not a timeout issue because of the long response.
Client doesn't break connection. I tried to make request programaticly (to be sure that client doesn't break connection). And sometimes got the same error, while test client-application got response with 502 error from Ngnix.
Who can close connection and why? How to fix this issue?
来源:https://stackoverflow.com/questions/49778807/aws-nginx-upstream-prematurely-closed-connection-while-reading-response-header