Skip to content

Commit

Permalink
only capture gateway errors
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgb committed Feb 10, 2025
1 parent c3a1aa3 commit 2e1b92d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use axum::{
response::Response,
};
use handlebars::Handlebars;
use http::{uri::Authority, Uri};
use http::{uri::Authority, StatusCode, Uri};
use plane_dynamic_proxy::{
body::{to_simple_body, SimpleBody},
proxy::ProxyClient,
Expand Down Expand Up @@ -63,7 +63,9 @@ pub async fn proxy_request(

let (response, handler) = client.request(req).await.expect("Infallable");

if !response.status().is_success() {
if response.status() == StatusCode::GATEWAY_TIMEOUT
|| response.status() == StatusCode::BAD_GATEWAY
{
return render_error(State(server_state.clone()), path).await;
}

Expand Down

0 comments on commit 2e1b92d

Please sign in to comment.