diff --git a/index.js b/index.js
index e62d65ac60e78c9396f0f17a1514919069e0155f..f74241309399ea7c5c32484ae81f11638b7b6672 100644
--- a/index.js
+++ b/index.js
@@ -35,6 +35,43 @@ var mvtUnauthProxy = httpProxy.createProxyServer({
   target: proxyHostTarget,
 });
 
+// keep a referece of the proxyRequest in the req object
+wmsProxy.on('proxyReq', function (proxyReq, req) {
+  req._proxyReq = proxyReq;
+});
+
+mvtProxy.on('proxyReq', function (proxyReq, req) {
+  req._proxyReq = proxyReq;
+});
+
+mvtUnauthProxy.on('proxyReq', function (proxyReq, req) {
+  req._proxyReq = proxyReq;
+});
+
+wmsProxy.on('error', function (err, req, res) {
+  // If the client cancelled the request, abort the request to the upstream server
+  if (req.socket.destroyed && err.code === 'ECONNRESET') {
+    req._proxyReq.abort();
+  }
+  return console.log(`WMS Error, req.socket.destroyed: ${req.socket.destroyed}, ${err}`);
+});
+
+mvtProxy.on('error', function (err, req, res) {
+  // If the client cancelled the request, abort the request to the upstream server
+  if (req.socket.destroyed && err.code === 'ECONNRESET') {
+    req._proxyReq.abort();
+  }
+  return console.log(`MVT Error, req.socket.destroyed: ${req.socket.destroyed}, ${err}`);
+});
+
+mvtUnauthProxy.on('error', function (err, req, res) {
+  // If the client cancelled the request, abort the request to the upstream server
+  if (req.socket.destroyed && err.code === 'ECONNRESET') {
+    req._proxyReq.abort();
+  }
+  return console.log(`MVT Unauthenticated Error, req.socket.destroyed: ${req.socket.destroyed}, ${err}`);
+});
+
 // Create an HTTP server
 http.createServer(async function (req, res) {