[PR #12867] fix(server): exempt /global/health from auth middleware #14407

Open
opened 2026-02-16 18:19:12 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/12867

State: open
Merged: No


Summary

  • When OPENCODE_SERVER_PASSWORD is set, the Basic Auth middleware was applied to all routes, including /global/health. Health check endpoints should be publicly accessible so monitoring tools and load balancers can verify the server is running without needing credentials.
  • Added a path check in the auth middleware to skip authentication for /global/health.

Fixes #12805

Test plan

  • Start server with OPENCODE_SERVER_PASSWORD set
  • Verify GET /global/health returns 200 without credentials
  • Verify other endpoints still require Basic Auth when OPENCODE_SERVER_PASSWORD is set
  • Verify all endpoints work normally when OPENCODE_SERVER_PASSWORD is not set
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/12867 **State:** open **Merged:** No --- ## Summary - When `OPENCODE_SERVER_PASSWORD` is set, the Basic Auth middleware was applied to all routes, including `/global/health`. Health check endpoints should be publicly accessible so monitoring tools and load balancers can verify the server is running without needing credentials. - Added a path check in the auth middleware to skip authentication for `/global/health`. Fixes #12805 ## Test plan - [ ] Start server with `OPENCODE_SERVER_PASSWORD` set - [ ] Verify `GET /global/health` returns 200 without credentials - [ ] Verify other endpoints still require Basic Auth when `OPENCODE_SERVER_PASSWORD` is set - [ ] Verify all endpoints work normally when `OPENCODE_SERVER_PASSWORD` is not set
yindo added the pull-request label 2026-02-16 18:19:12 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14407