Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ use crate::{

pub(crate) static ENROLLMENT_COOKIE_NAME: &str = "defguard_proxy";
pub(crate) static PASSWORD_RESET_COOKIE_NAME: &str = "defguard_proxy_password_reset";
const DEFGUARD_CORE_CONNECTED_HEADER: &str = "defguard-core-connected";
const DEFGUARD_CORE_VERSION_HEADER: &str = "defguard-core-version";
const RATE_LIMITER_CLEANUP_PERIOD: Duration = Duration::from_secs(60);
const X_FORWARDED_FOR: &str = "x-forwarded-for";
Expand Down Expand Up @@ -143,6 +144,17 @@ async fn core_version_middleware(
}
}

let core_connected = app_state.grpc_server.connected.load(Ordering::Relaxed);
let core_connected_header = if core_connected {
HeaderValue::from_static("true")
} else {
HeaderValue::from_static("false")
};

response
.headers_mut()
.insert(DEFGUARD_CORE_CONNECTED_HEADER, core_connected_header);

response
}

Expand Down