From d989a3b631d082b3ac881ffcc48a010382c53c1f Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Mon, 29 Jul 2024 11:22:34 +0530 Subject: [PATCH] [server] Stop exposing /metrics for self-hosted users Doesn't impact Ente's production instances since this endpoint was disallowed on the load balancer, but instead of requiring the same for folks who are self hosting we modify the source to not expose /metrics on :8080 (they'll still be available on :2112). Refs: - https://github.com/zsais/go-gin-prometheus/blob/2199a42d96c1d40f249909ed2f27d42449c7fc94/middleware.go#L345 - https://github.com/ente-io/ente/discussions/2562 --- server/cmd/museum/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/cmd/museum/main.go b/server/cmd/museum/main.go index 9258fa9b77..1413e48686 100644 --- a/server/cmd/museum/main.go +++ b/server/cmd/museum/main.go @@ -353,7 +353,7 @@ func main() { p := ginprometheus.NewPrometheus("museum") p.ReqCntURLLabelMappingFn = urlSanitizer - p.Use(server) + server.Use(p.HandlerFunc()) // note: the recover middleware must be in the last server.Use(requestid.New(), middleware.Logger(urlSanitizer), cors(), gzip.Gzip(gzip.DefaultCompression), middleware.PanicRecover())