diff --git a/proxy/http/server.go b/proxy/http/server.go index 4bf81e3d..76970517 100644 --- a/proxy/http/server.go +++ b/proxy/http/server.go @@ -103,7 +103,11 @@ Start: if len(s.config.Accounts) > 0 { user, pass, ok := parseBasicAuth(request.Header.Get("Proxy-Authorization")) - if !ok || !s.config.HasAccount(user, pass) { + if !ok { + _, err := conn.Write([]byte("HTTP/1.1 407 Proxy Authentication Required\r\n\r\n")) + return err + } + if !s.config.HasAccount(user, pass) { _, err := conn.Write([]byte("HTTP/1.1 401 UNAUTHORIZED\r\n\r\n")) return err }