From 66f2a4df94ed5d6f91ab1e9becd6e5c49551a15a Mon Sep 17 00:00:00 2001 From: bel Date: Mon, 1 Apr 2024 06:46:27 -0600 Subject: [PATCH] passthrough basic auth if not configred at rproxy3 level --- go.mod | 2 +- server/server.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 4a58970..9ea8699 100644 --- a/go.mod +++ b/go.mod @@ -10,4 +10,4 @@ require ( golang.org/x/time v0.1.0 ) -require gopkg.in/yaml.v2 v2.4.0 // indirect +require gopkg.in/yaml.v2 v2.4.0 diff --git a/server/server.go b/server/server.go index 4ffbfbc..742f090 100755 --- a/server/server.go +++ b/server/server.go @@ -154,7 +154,7 @@ func (s *Server) Pre(foo http.HandlerFunc) http.HandlerFunc { log.Printf("failed to lookup auth for %s (%s): %v", r.Host, mapKey(r.Host), err) w.Header().Set("WWW-Authenticate", "Basic") http.Error(w, err.Error(), http.StatusUnauthorized) - } else if _, p, _ := r.BasicAuth(); auth != p { + } else if _, p, _ := r.BasicAuth(); auth != "" && auth != p { log.Printf("failed to auth: expected %q but got %q", auth, p) w.Header().Set("WWW-Authenticate", "Basic") http.Error(w, "unexpected basic auth", http.StatusUnauthorized)