From b2e1325d95950f648f915ab07c31362f3524a638 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 10 Apr 2015 23:53:20 +0000 Subject: proxy_pass: attempt to forward premature upstream responses Upstreams may shut us down while we're writing a request body, attempt to forward any responses from the upstream back to the client which may explain the rejection reason for giant uploads. --- lib/yahns/proxy_pass.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/yahns/proxy_pass.rb') diff --git a/lib/yahns/proxy_pass.rb b/lib/yahns/proxy_pass.rb index d02bb40..e86e9c9 100644 --- a/lib/yahns/proxy_pass.rb +++ b/lib/yahns/proxy_pass.rb @@ -139,6 +139,11 @@ class Yahns::ProxyPass # :nodoc: close_req_body(input) prepare_wait_readable end + rescue Errno::EPIPE, Errno::ECONNRESET, Errno::ENOTCONN + # no more reading off the client socket, just prepare to forward + # the rejection response from the upstream (if any) + @yahns_client.to_io.shutdown(Socket::SHUT_RD) + prepare_wait_readable end def prepare_wait_readable -- cgit v1.2.3-24-ge0c7