fix: authenticate dashboard health probe
This commit is contained in:
+6
-1
@@ -29,7 +29,12 @@ class GatewayHttpProbe(
|
||||
bearerToken: String,
|
||||
sessionCookie: String
|
||||
): GatewayProbeResult {
|
||||
val health = getJson("$baseUrl/health")
|
||||
// Hermes dashboard auth gates every protected route, including /health.
|
||||
// A successful password login therefore must send its session cookie to
|
||||
// the health probe as well as /v1/models; otherwise the 302-to-login
|
||||
// response is incorrectly presented as a generic offline failure.
|
||||
val healthCookie = if (authMode == ConnectionAuthMode.PasswordLogin) sessionCookie else ""
|
||||
val health = getJson("$baseUrl/health", sessionCookie = healthCookie)
|
||||
if (health != HttpProbeResult.Success) return health.toGatewayResult("Health probe")
|
||||
if (authMode == ConnectionAuthMode.None) {
|
||||
return GatewayProbeResult.Healthy("Gateway health check passed.")
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ class GatewayHttpProbeTest {
|
||||
assertTrue(result is GatewayProbeResult.Healthy)
|
||||
assertEquals(
|
||||
listOf(
|
||||
Triple("/health", null, null),
|
||||
Triple("/health", null, SESSION_COOKIE),
|
||||
Triple("/v1/models", null, SESSION_COOKIE)
|
||||
),
|
||||
requests
|
||||
|
||||
Reference in New Issue
Block a user