Skip to content

fix: make /health endpoint trailing-slash tolerant - #70

Merged
jonbaldie merged 1 commit into
mainfrom
fix/67-health-trailing-slash
Aug 31, 2026
Merged

fix: make /health endpoint trailing-slash tolerant#70
jonbaldie merged 1 commit into
mainfrom
fix/67-health-trailing-slash

Conversation

@jonbaldie

Copy link
Copy Markdown
Owner

Closes #67

Both the health-route registration and the auth-bypass pattern matched the exact literal /health, so /health/ fell through to the auth check (401, since no Authorization header is expected on a public probe) and would 404 even with a valid token. Load balancers and k8s probes commonly append a trailing slash.

Both patterns now use /health{/}? so the trailing-slash variant is treated identically to /health.

Verified: reproduced 401 on GET /health/ against the old code, wrote a regression test asserting 200 + no auth required, confirmed it failed before the fix and passes after. Full test suite (217 tests) green.

🤖 Generated with Claude Code

The health route and its auth bypass both matched the exact literal
path /health, so /health/ fell through to the auth check (401) and
would 404 even with a valid token. Both patterns now accept an
optional trailing slash.

Fixes #67

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q25veeccRvgA5zjp6Fhijq
@jonbaldie
jonbaldie merged commit fa28401 into main Aug 31, 2026
4 checks passed
@jonbaldie
jonbaldie deleted the fix/67-health-trailing-slash branch August 31, 2026 11:56
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.

Health endpoint returns 401 for trailing-slash variant /health/ (public probe marked unhealthy)

1 participant