diff --git a/core/http/app.go b/core/http/app.go index 23e97f18d92b..2cf0ad17f26c 100644 --- a/core/http/app.go +++ b/core/http/app.go @@ -121,6 +121,9 @@ func App(cl *config.BackendConfigLoader, ml *model.ModelLoader, appConfig *confi }) } + // Health Checks should always be exempt from auth, so register these first + routes.HealthRoutes(app) + kaConfig, err := middleware.GetKeyAuthConfig(appConfig) if err != nil || kaConfig == nil { return nil, fmt.Errorf("failed to create key auth config: %w", err) diff --git a/core/http/routes/health.go b/core/http/routes/health.go new file mode 100644 index 000000000000..f5a08e9baf37 --- /dev/null +++ b/core/http/routes/health.go @@ -0,0 +1,13 @@ +package routes + +import "github.com/gofiber/fiber/v2" + +func HealthRoutes(app *fiber.App) { + // Service health checks + ok := func(c *fiber.Ctx) error { + return c.SendStatus(200) + } + + app.Get("/healthz", ok) + app.Get("/readyz", ok) +} diff --git a/core/http/routes/localai.go b/core/http/routes/localai.go index 247596c0e20d..2f65e7796c01 100644 --- a/core/http/routes/localai.go +++ b/core/http/routes/localai.go @@ -42,14 +42,6 @@ func RegisterLocalAIRoutes(app *fiber.App, app.Post("/stores/get", localai.StoresGetEndpoint(sl, appConfig)) app.Post("/stores/find", localai.StoresFindEndpoint(sl, appConfig)) - // Kubernetes health checks - ok := func(c *fiber.Ctx) error { - return c.SendStatus(200) - } - - app.Get("/healthz", ok) - app.Get("/readyz", ok) - app.Get("/metrics", localai.LocalAIMetricsEndpoint()) // Experimental Backend Statistics Module