Implement health check endpoint on separate local port and HTTPS fallback

- Add health.rs module with start_health_check_listener() that binds to
  127.0.0.1:{health_check_port} and serves GET /health returning 200 OK
  with empty body
- Add health_route() in proxy/handler.rs for HTTPS listener fallback
- Add port conflict detection in config validation: health_check_port
  must not conflict with listener ports on 127.0.0.1/localhost/0.0.0.0
- health_check_port = 0 disables the separate listener (handled at call
  site)
- Add unit and integration tests for health check functionality
This commit is contained in:
2026-06-11 12:39:24 +00:00
parent 468adb21de
commit c423a58778
5 changed files with 1143 additions and 19 deletions

View File

@@ -1,2 +1,12 @@
#[allow(dead_code)]
pub struct ProxyHandler;
use axum::http::StatusCode;
use axum::response::IntoResponse;
use axum::routing::get;
use axum::Router;
async fn health_handler() -> impl IntoResponse {
StatusCode::OK
}
pub fn health_route() -> Router {
Router::new().route("/health", get(health_handler))
}