aboutsummaryrefslogtreecommitdiffhomepage
path: root/pingora-proxy/src/proxy_trait.rs
diff options
context:
space:
mode:
authorAndrew Hauck <[email protected]>2024-11-08 14:34:14 -0800
committerYuchen Wu <[email protected]>2024-12-13 17:27:40 -0800
commita8a6e77eef2c0f4d2a45f00c5b0e316dd373f2f2 (patch)
treec5eb5e7b4e8b4c267de63f1c338365a09847a584 /pingora-proxy/src/proxy_trait.rs
parente309436319ed5cbc3aaf53221070a1fd070b8bcf (diff)
downloadpingora-a8a6e77eef2c0f4d2a45f00c5b0e316dd373f2f2.tar.gz
pingora-a8a6e77eef2c0f4d2a45f00c5b0e316dd373f2f2.zip
Improve support for sending custom response headers and bodies for error messages
Diffstat (limited to 'pingora-proxy/src/proxy_trait.rs')
-rw-r--r--pingora-proxy/src/proxy_trait.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/pingora-proxy/src/proxy_trait.rs b/pingora-proxy/src/proxy_trait.rs
index 4017789..6970ec0 100644
--- a/pingora-proxy/src/proxy_trait.rs
+++ b/pingora-proxy/src/proxy_trait.rs
@@ -372,7 +372,6 @@ pub trait ProxyHttp {
where
Self::CTX: Send + Sync,
{
- let server_session = session.as_mut();
let code = match e.etype() {
HTTPStatus(code) => *code,
_ => {
@@ -392,7 +391,9 @@ pub trait ProxyHttp {
}
};
if code > 0 {
- server_session.respond_error(code).await
+ session.respond_error(code).await.unwrap_or_else(|e| {
+ error!("failed to send error response to downstream: {e}");
+ });
}
code
}