passthrough basic auth if not configred at rproxy3 level
parent
f083763f1d
commit
66f2a4df94
2
go.mod
2
go.mod
|
|
@ -10,4 +10,4 @@ require (
|
||||||
golang.org/x/time v0.1.0
|
golang.org/x/time v0.1.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require gopkg.in/yaml.v2 v2.4.0 // indirect
|
require gopkg.in/yaml.v2 v2.4.0
|
||||||
|
|
|
||||||
|
|
@ -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)
|
log.Printf("failed to lookup auth for %s (%s): %v", r.Host, mapKey(r.Host), err)
|
||||||
w.Header().Set("WWW-Authenticate", "Basic")
|
w.Header().Set("WWW-Authenticate", "Basic")
|
||||||
http.Error(w, err.Error(), http.StatusUnauthorized)
|
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)
|
log.Printf("failed to auth: expected %q but got %q", auth, p)
|
||||||
w.Header().Set("WWW-Authenticate", "Basic")
|
w.Header().Set("WWW-Authenticate", "Basic")
|
||||||
http.Error(w, "unexpected basic auth", http.StatusUnauthorized)
|
http.Error(w, "unexpected basic auth", http.StatusUnauthorized)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue