From 27294df57608b83ef812a765006ab8164eb13672 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 8 Dec 2024 16:11:24 +0100 Subject: [PATCH] api/server: Server.CreateMux: also register API-version debug endpoints The debug endpoints are currently only provided non-versioned (e.g. `/debug/vars`). While this is convenient, we "officially" deprecated non-versioned endpoints in the API. This patch also registers the debug-endpoints under the API-versioned paths, so that they can be used either without version ("latest") and versioned paths. Signed-off-by: Sebastiaan van Stijn --- api/server/server.go | 1 + docs/api/version-history.md | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/api/server/server.go b/api/server/server.go index d46b77aad4..7fbba7da66 100644 --- a/api/server/server.go +++ b/api/server/server.go @@ -83,6 +83,7 @@ func (s *Server) CreateMux(routers ...router.Router) *mux.Router { debugRouter := debug.NewRouter() for _, r := range debugRouter.Routes() { f := s.makeHTTPHandler(r.Handler(), r.Method()+" "+r.Path()) + m.Path(versionMatcher + r.Path()).Methods(r.Method()).Handler(f) m.Path(r.Path()).Methods(r.Method()).Handler(f) } diff --git a/docs/api/version-history.md b/docs/api/version-history.md index 5921d63b4f..52f80ee973 100644 --- a/docs/api/version-history.md +++ b/docs/api/version-history.md @@ -58,6 +58,10 @@ keywords: "API, Docker, rcli, REST, documentation" the one that sorts first is picked. * `GET /containers/json` now returns a `GwPriority` field in `NetworkSettings` for each network endpoint. +* API debug endpoints (`GET /debug/vars`, `GET /debug/pprof/`, `GET /debug/pprof/cmdline`, + `GET /debug/pprof/profile`, `GET /debug/pprof/symbol`, `GET /debug/pprof/trace`, + `GET /debug/pprof/{name}`) are now also accessible through the versioned-API + paths (`/v/`). ## v1.47 API changes