From 6f412e6a8af8af9160049a8e54305c78e0a0a519 Mon Sep 17 00:00:00 2001 From: Alexander Trost Date: Thu, 14 Jun 2018 23:53:12 +0200 Subject: [PATCH] Exclude /metrics path from private repos check (#69) Signed-off-by: Alexander Trost --- handlers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers.go b/handlers.go index 8f8e655..ec66e2f 100644 --- a/handlers.go +++ b/handlers.go @@ -157,7 +157,7 @@ func (s Server) AuthHandler(f *HtpasswdFile, h http.Handler) http.HandlerFunc { http.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized) return } - if s.PrivateRepos && !isUserPath(username, r.URL.Path) { + if s.PrivateRepos && !isUserPath(username, r.URL.Path) && r.URL.Path != "/metrics" { http.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized) return }