SIGN IN SIGN UP
caddyserver / caddy UNCLAIMED

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

0 0 76 Go

metrics: Add nil check for metricsHandler in AdminMetrics.serveHTTP (#7553)

* metrics: Add nil check for metricsHandler in AdminMetrics.serveHTTP

Prevents panic when the admin metrics endpoint is accessed before
the module is fully provisioned. Returns a proper API error instead
of crashing.

* admin: provision router modules before registering routes

Instead of adding a nil check for metricsHandler, address the root
cause by provisioning admin router modules before calling Routes().
This ensures all handler state is initialized before routes are
registered on the mux.

Merge newAdminHandler and provisionAdminRouters into a single step,
removing the two-phase setup where routes were registered first and
modules provisioned later. The AdminConfig.routers field is no longer
needed since provisioning happens inline.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: go fmt admin.go

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
B
Br1an committed
d80774cb3fe6abcd0fea9dd0c68812ee94c7cf2a
Parent: a4a38c3
Committed by GitHub <noreply@github.com> on 5/11/2026, 11:27:03 PM