fix: proxy forwards mbe health to Core API instead of direct llama-server access
- Previously proxy accessed llama-server /health endpoint directly - Now forwards /api/v1/mbe/health to Core API (3002) which has full health check - Returns complete health info: status, model, uptime - Fixes frontend not showing 'online' status in Admin Settings
This commit is contained in:
@@ -265,20 +265,8 @@ async fn fallback_handler(State(state): State<ProxyState>, req: axum::extract::R
|
|||||||
|
|
||||||
// Handle MBE health check proxy
|
// Handle MBE health check proxy
|
||||||
if path == "/api/v1/mbe/health" {
|
if path == "/api/v1/mbe/health" {
|
||||||
let client = reqwest::Client::new();
|
// Forward to Core API which has full health check logic
|
||||||
match client.get("http://localhost:8080/health").send().await {
|
return proxy_to(state, req, CORE_API, false).await;
|
||||||
Ok(resp) => {
|
|
||||||
let status = resp.status().as_u16();
|
|
||||||
let body = resp.bytes().await.unwrap_or_default();
|
|
||||||
let status_code = axum::http::StatusCode::from_u16(status).unwrap_or(axum::http::StatusCode::INTERNAL_SERVER_ERROR);
|
|
||||||
let mut builder = axum::http::Response::builder().status(status_code);
|
|
||||||
builder = builder.header("content-type", "application/json");
|
|
||||||
return builder.body(axum::body::Body::from(body)).unwrap().into_response();
|
|
||||||
}
|
|
||||||
Err(_) => {
|
|
||||||
return (StatusCode::SERVICE_UNAVAILABLE, "{\"status\":\"unreachable\"}").into_response();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if path.starts_with("/api/v2/") {
|
if path.starts_with("/api/v2/") {
|
||||||
|
|||||||
Reference in New Issue
Block a user