Exclude /metrics path from private repos check (#69)

Signed-off-by: Alexander Trost <galexrt@googlemail.com>
This commit is contained in:
Alexander Trost 2018-06-14 23:53:12 +02:00 committed by Matt Holt
parent 420b1d3ee8
commit 6f412e6a8a

View file

@ -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
}