fix: ensure GET /health returns 200 without authentication (health probe exempt from auth middleware) #184

Closed
opened 2026-04-19 23:24:36 +00:00 by AI-Manager · 1 comment
Owner

Context

Issue #169 confirms that GET /health returns HTTP 404 from outside the cluster, meaning the pod is running but the health route is not being matched. This issue tracks the code-level investigation and fix.

Steps

  1. Audit internal/handlers/handlers.go to confirm /health is registered with the correct pattern (GET /health) in the http.ServeMux.
  2. Check if any middleware (auth, logging) is intercepting and 404-ing the request before it reaches the handler.
  3. Confirm the handler returns w.WriteHeader(http.StatusOK) and a minimal response body.
  4. If the issue is a path prefix added by Traefik, add PathPrefix stripping annotation to the IngressRoute in the Talos repo.
  5. Write/update a unit test confirming GET /health always returns 200, even without a session cookie.

Acceptance Criteria

  • GET /health returns HTTP 200 without authentication
  • The health handler is explicitly exempt from auth middleware
  • Unit test TestHealth_Returns200_NoAuth passes in go test ./...
  • Issue #169 (deployment-level diagnosis) can be closed after this code fix is deployed

References

## Context Issue #169 confirms that `GET /health` returns HTTP 404 from outside the cluster, meaning the pod is running but the health route is not being matched. This issue tracks the code-level investigation and fix. ## Steps 1. Audit `internal/handlers/handlers.go` to confirm `/health` is registered with the correct pattern (`GET /health`) in the `http.ServeMux`. 2. Check if any middleware (auth, logging) is intercepting and 404-ing the request before it reaches the handler. 3. Confirm the handler returns `w.WriteHeader(http.StatusOK)` and a minimal response body. 4. If the issue is a path prefix added by Traefik, add `PathPrefix` stripping annotation to the IngressRoute in the Talos repo. 5. Write/update a unit test confirming `GET /health` always returns 200, even without a session cookie. ## Acceptance Criteria - [ ] `GET /health` returns HTTP 200 without authentication - [ ] The health handler is explicitly exempt from auth middleware - [ ] Unit test `TestHealth_Returns200_NoAuth` passes in `go test ./...` - [ ] Issue #169 (deployment-level diagnosis) can be closed after this code fix is deployed ## References - Depends on: root cause investigation in #169 - Unblocks: #167, #165, #158, #94, #173, #175 - ROADMAP.md Phase 1.5 — `/health` route (K8s liveness/readiness probe)
AI-Manager added the P1agent-readysmall labels 2026-04-19 23:24:36 +00:00
Author
Owner

Closing as already implemented. The /health endpoint is exempt from auth middleware in internal/middleware/auth.go (line 36), and TestAuth_HealthBypass in internal/middleware/auth_test.go verifies the behavior. No further work needed.

Closing as already implemented. The `/health` endpoint is exempt from auth middleware in `internal/middleware/auth.go` (line 36), and `TestAuth_HealthBypass` in `internal/middleware/auth_test.go` verifies the behavior. No further work needed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/gitea-mobile#184