Skip to content

Commit

Permalink
server: exempt healthcheck endpoint from authentication check
Browse files Browse the repository at this point in the history
Fixes #24942

Release note: None
  • Loading branch information
Pete Vilter authored and couchand committed May 16, 2018
1 parent beb91cf commit f0eab2e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 1 addition & 3 deletions pkg/server/admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1041,9 +1041,7 @@ func TestHealthAPI(t *testing.T) {
}
s.Clock().Update(hlc.Timestamp(self.Expiration).Add(1, 0))

// Health API is not accessible if the node is not accessible, because it
// cannot verify the authentication session.
expected := "401 Unauthorized"
expected := "503 Service Unavailable"
var resp serverpb.HealthResponse
for {
if err := getAdminJSONProto(s, "health", &resp); !testutils.IsError(err, expected) {
Expand Down
2 changes: 2 additions & 0 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1472,6 +1472,8 @@ If problems persist, please see ` + base.DocsURL("cluster-setup-troubleshooting.
s.serveMode.set(modeOperational)

s.mux.Handle(adminPrefix, authHandler)
// Exempt the health check endpoint from authentication.
s.mux.Handle("/_admin/v1/health", gwMux)
s.mux.Handle(ts.URLPrefix, authHandler)
s.mux.Handle(statusPrefix, authHandler)
s.mux.Handle(authPrefix, gwMux)
Expand Down

0 comments on commit f0eab2e

Please sign in to comment.