Can i just do this:
error_page 404 =400;
error_page 502 =500 @close_conns;
location @close_conns {
internal;
keepalive_requests 0;
}
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,254535,254546#msg-254546