diff --git a/cmd/admin-router.go b/cmd/admin-router.go index 7cd505d12..4657bbccb 100644 --- a/cmd/admin-router.go +++ b/cmd/admin-router.go @@ -53,12 +53,14 @@ func registerAdminRouter(router *mux.Router) { // Info operations adminV1Router.Methods(http.MethodGet).Path("/info").HandlerFunc(httpTraceAll(adminAPI.ServerInfoHandler)) - /// Heal operations + if globalIsDistXL || globalIsXL { + /// Heal operations - // Heal processing endpoint. - adminV1Router.Methods(http.MethodPost).Path("/heal/").HandlerFunc(httpTraceAll(adminAPI.HealHandler)) - adminV1Router.Methods(http.MethodPost).Path("/heal/{bucket}").HandlerFunc(httpTraceAll(adminAPI.HealHandler)) - adminV1Router.Methods(http.MethodPost).Path("/heal/{bucket}/{prefix:.*}").HandlerFunc(httpTraceAll(adminAPI.HealHandler)) + // Heal processing endpoint. + adminV1Router.Methods(http.MethodPost).Path("/heal/").HandlerFunc(httpTraceAll(adminAPI.HealHandler)) + adminV1Router.Methods(http.MethodPost).Path("/heal/{bucket}").HandlerFunc(httpTraceAll(adminAPI.HealHandler)) + adminV1Router.Methods(http.MethodPost).Path("/heal/{bucket}/{prefix:.*}").HandlerFunc(httpTraceAll(adminAPI.HealHandler)) + } // Profiling operations adminV1Router.Methods(http.MethodPost).Path("/profiling/start").HandlerFunc(httpTraceAll(adminAPI.StartProfilingHandler)). @@ -102,4 +104,7 @@ func registerAdminRouter(router *mux.Router) { // List policies adminV1Router.Methods(http.MethodGet).Path("/list-canned-policies").HandlerFunc(httpTraceHdrs(adminAPI.ListCannedPolicies)) + + // If none of the routes match. + adminV1Router.NotFoundHandler = http.HandlerFunc(httpTraceHdrs(notFoundHandler)) } diff --git a/cmd/gateway-main.go b/cmd/gateway-main.go index 372a74d4a..b7336a5e3 100644 --- a/cmd/gateway-main.go +++ b/cmd/gateway-main.go @@ -169,6 +169,14 @@ func StartGateway(ctx *cli.Context, gw Gateway) { router := mux.NewRouter().SkipClean(true) + if globalEtcdClient != nil { + // Enable STS router if etcd is enabled. + registerSTSRouter(router) + + // Enable admin router if etcd is enabled. + registerAdminRouter(router) + } + // Add healthcheck router registerHealthCheckRouter(router) @@ -180,11 +188,6 @@ func StartGateway(ctx *cli.Context, gw Gateway) { logger.FatalIf(registerWebRouter(router), "Unable to configure web browser") } - // Enable STS router if etcd is enabled. - if globalEtcdClient != nil { - registerSTSRouter(router) - } - // Add API router. registerAPIRouter(router)