Skip to content

Add unauthenticated /healthz endpoint - #174

Open
neverlless wants to merge 1 commit into
ubccr:mainfrom
neverlless:feat/healthz-endpoint
Open

Add unauthenticated /healthz endpoint#174
neverlless wants to merge 1 commit into
ubccr:mainfrom
neverlless:feat/healthz-endpoint

Conversation

@neverlless

@neverlless neverlless commented Jul 21, 2026

Copy link
Copy Markdown

Motivation

There is currently no way to health-check mokey without hitting authenticated pages: probing / (Kubernetes probes, blackbox_exporter, uptime monitors) redirects to login, logs Login required and no authenticated session found on every probe, and — because the CSRF middleware saves a session on every GET — creates a new session storage entry per probe.

Changes

  • New GET /healthz endpoint returning 200 {"status":"ok"} when healthy, or 503 with the failing component when the session storage backend or FreeIPA is unreachable (uses storage.Get and the admin client's Ping()).
  • Registered before the CSRF middleware, so probes don't create sessions and don't spam logs.

Testing

Running in production as Kubernetes startup/readiness probe and blackbox_exporter target:

$ curl -s -w ' -> %{http_code}
' http://localhost:8866/healthz
{"status":"ok"} -> 200

Log spam from probes is gone, and no per-probe sessions accumulate in redis anymore.

Checks session storage and FreeIPA connectivity, returns JSON status.
Registered before the CSRF middleware so monitoring probes don't
create sessions or log 'Login required' errors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant