diff --git a/src/routes/mailserver.js b/src/routes/mailserver.js index 41eccd598..8e96dbd81 100644 --- a/src/routes/mailserver.js +++ b/src/routes/mailserver.js @@ -46,7 +46,7 @@ async function proxyToMailContainer(port, pathname, req, res, next) { req.clearTimeout(); // TODO: add timeout to mail server proxy logic instead of this mailserverProxy(req, res, function (error) { - if (!error) return next(); + if (!error) return; // response was already sent by proxy, do not proceed to connect-lastmile if (error.code === 'ECONNREFUSED') return next(new HttpError(424, 'Unable to connect to mail server')); if (error.code === 'ECONNRESET') return next(new HttpError(424, 'Unable to query mail server'));