diff --git a/core/src/main/java/io/undertow/server/handlers/proxy/ProxyHandler.java b/core/src/main/java/io/undertow/server/handlers/proxy/ProxyHandler.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/io/undertow/server/handlers/proxy/ProxyHandler.java
+++ b/core/src/main/java/io/undertow/server/handlers/proxy/ProxyHandler.java
@@ -711,8 +711,8 @@ public final class ProxyHandler implements HttpHandler {
         @Override
         public void handleException(Channel channel, IOException exception) {
             IoUtils.safeClose(channel);
+            IoUtils.safeClose(clientConnection);
             if (exchange.isResponseStarted()) {
-                IoUtils.safeClose(clientConnection);
                 UndertowLogger.REQUEST_IO_LOGGER.debug("Exception reading from target server", exception);
                 if (!exchange.isResponseStarted()) {
                     exchange.setResponseCode(StatusCodes.INTERNAL_SERVER_ERROR);
Make sure the client connection is closed on exception