Skip to content

Commit

Permalink
fix(dgw): prevent error traces caused by browser behavior (#864)
Browse files Browse the repository at this point in the history
Since those are not actual errors, this was creating noise in the logs.

Issue: DGW-128
  • Loading branch information
CBenoit authored May 16, 2024
1 parent 245e2cf commit 25b86ea
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions devolutions-gateway/src/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,20 @@ where
.call(request)
});

hyper_util::server::conn::auto::Builder::new(hyper_util::rt::TokioExecutor::new())
let result = hyper_util::server::conn::auto::Builder::new(hyper_util::rt::TokioExecutor::new())
.serve_connection_with_upgrades(hyper_util::rt::TokioIo::new(io), service)
.await
.map_err(|e| anyhow::anyhow!(e).context("HTTP server"))
.await;

match result {
Ok(()) => Ok(()),
Err(e) => match e.downcast_ref::<hyper::Error>() {
Some(e) if e.is_canceled() || e.is_incomplete_message() => {
debug!(error = %e, "Request was cancelled");
Ok(())
}
_ => Err(anyhow::anyhow!(e).context("HTTP server")),
},
}
}

pub trait ToInternalUrl {
Expand Down

0 comments on commit 25b86ea

Please sign in to comment.