fix: authenticate dashboard health probe
This commit is contained in:
+6
-1
@@ -29,7 +29,12 @@ class GatewayHttpProbe(
|
|||||||
bearerToken: String,
|
bearerToken: String,
|
||||||
sessionCookie: String
|
sessionCookie: String
|
||||||
): GatewayProbeResult {
|
): 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 (health != HttpProbeResult.Success) return health.toGatewayResult("Health probe")
|
||||||
if (authMode == ConnectionAuthMode.None) {
|
if (authMode == ConnectionAuthMode.None) {
|
||||||
return GatewayProbeResult.Healthy("Gateway health check passed.")
|
return GatewayProbeResult.Healthy("Gateway health check passed.")
|
||||||
|
|||||||
+1
-1
@@ -72,7 +72,7 @@ class GatewayHttpProbeTest {
|
|||||||
assertTrue(result is GatewayProbeResult.Healthy)
|
assertTrue(result is GatewayProbeResult.Healthy)
|
||||||
assertEquals(
|
assertEquals(
|
||||||
listOf(
|
listOf(
|
||||||
Triple("/health", null, null),
|
Triple("/health", null, SESSION_COOKIE),
|
||||||
Triple("/v1/models", null, SESSION_COOKIE)
|
Triple("/v1/models", null, SESSION_COOKIE)
|
||||||
),
|
),
|
||||||
requests
|
requests
|
||||||
|
|||||||
Reference in New Issue
Block a user