mirror of
https://github.com/restic/rest-server.git
synced 2026-10-15 15:10:07 -07:00
auth: include Basic challenge in 401 responses
Requests rejected by Basic authentication currently return 401 without WWW-Authenticate, preventing HTTP clients from prompting for credentials. Advertise the Basic scheme on the server and metrics auth paths while leaving proxy authentication unchanged.
This commit is contained in:
+1
-1
@@ -59,7 +59,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
// First of all, check auth (will always pass if NoAuth is set)
|
||||
username, ok := s.checkAuth(r)
|
||||
if !ok {
|
||||
httpDefaultError(w, http.StatusUnauthorized)
|
||||
s.writeUnauthorized(w)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user