From 3adc311c1cc0f534c782a11d2cdaeb2133e5113a Mon Sep 17 00:00:00 2001 From: poornas Date: Wed, 16 Oct 2019 20:39:23 -0700 Subject: [PATCH] Fix regression in admin router when no route matches (#8409) When `mc admin user add` is attempted in gateway mode without etcd setup, NoSuchBucket error is returned instead of MethodNotAllowed. Regression from commit - e48005ddc72d0a26f689a77962a15d8eaa99bfe2 --- cmd/admin-router.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/admin-router.go b/cmd/admin-router.go index cb870f733..4acb10668 100644 --- a/cmd/admin-router.go +++ b/cmd/admin-router.go @@ -144,5 +144,6 @@ func registerAdminRouter(router *mux.Router, enableConfigOps, enableIAMOps bool) adminV1Router.Methods(http.MethodGet).Path("/kms/key/status").HandlerFunc(httpTraceAll(adminAPI.KMSKeyStatusHandler)) // If none of the routes match, return error. + adminV1Router.NotFoundHandler = http.HandlerFunc(httpTraceHdrs(notFoundHandler)) adminV1Router.MethodNotAllowedHandler = http.HandlerFunc(httpTraceAll(versionMismatchHandler)) }