From a60d54dbfd93f74187b4051f1522c42d34480503 Mon Sep 17 00:00:00 2001
From: Matthew Holt <mholt@users.noreply.github.com>
Date: Tue, 3 Sep 2019 19:10:09 -0600
Subject: [PATCH] reverse_proxy: Ignore context.Canceled errors

These happen when downstream clients cancel the request, but that's not
our problem nor a failure in our end
---
 modules/caddyhttp/reverseproxy/reverseproxy.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/modules/caddyhttp/reverseproxy/reverseproxy.go b/modules/caddyhttp/reverseproxy/reverseproxy.go
index 16d7f7a11..7bf9a2f53 100644
--- a/modules/caddyhttp/reverseproxy/reverseproxy.go
+++ b/modules/caddyhttp/reverseproxy/reverseproxy.go
@@ -224,7 +224,9 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyht
 
 		// proxy the request to that upstream
 		proxyErr = h.reverseProxy(w, r, upstream)
-		if proxyErr == nil {
+		if proxyErr == nil || proxyErr == context.Canceled {
+			// context.Canceled happens when the downstream client
+			// cancels the request; we don't have to worry about that
 			return nil
 		}