From 8fcc787cbaf513854ddba82f790c6ca5938ea219 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 5 Dec 2018 11:54:12 -0800 Subject: [PATCH] Register notFound handler only once per root router (#6926) registering notFound handler more than once causes gorilla mux to return error for all registered paths greater than > 8. This might be a bug in the gorilla/mux but we shouldn't be using it this way. NotFound handler should be only registered once per root router. Fixes #6915 --- cmd/storage-rest-server.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/storage-rest-server.go b/cmd/storage-rest-server.go index f0701864a..d85279068 100644 --- a/cmd/storage-rest-server.go +++ b/cmd/storage-rest-server.go @@ -377,7 +377,7 @@ func registerStorageRESTHandlers(router *mux.Router, endpoints EndpointList) { Queries(restQueries(storageRESTVolume, storageRESTFilePath)...) subrouter.Methods(http.MethodPost).Path("/" + storageRESTMethodRenameFile).HandlerFunc(httpTraceHdrs(server.RenameFileHandler)). Queries(restQueries(storageRESTSrcVolume, storageRESTSrcPath, storageRESTDstVolume, storageRESTDstPath)...) - - subrouter.NotFoundHandler = http.HandlerFunc(httpTraceAll(notFoundHandler)) } + + router.NotFoundHandler = http.HandlerFunc(httpTraceAll(notFoundHandler)) }