Skip to content

Commit

Permalink
Improve health probe
Browse files Browse the repository at this point in the history
  • Loading branch information
tiberiuv committed Feb 24, 2025
1 parent 6011732 commit b46e196
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,19 @@ async fn check_ip(
}
}

async fn health() -> impl IntoResponse {
async fn health(
State(app): State<App>,
ExtractRealIp(real_client_ip): ExtractRealIp,
request: Request,
) -> impl IntoResponse {
let result = app
.appsec_client
.appsec_request(request, real_client_ip, app.config.proxy_headers)
.await;
if let Err(err) = result {
tracing::error!(?err);
return StatusCode::INTERNAL_SERVER_ERROR.into_response();
};
StatusCode::OK.into_response()
}

Expand Down

0 comments on commit b46e196

Please sign in to comment.