feat: logging unauthenticated requests
This commit is contained in:
@@ -34,6 +34,7 @@ func main() {
|
||||
u, p, ok := r.BasicAuth()
|
||||
if !ok || subtle.ConstantTimeCompare([]byte(u), []byte(username)) != 1 ||
|
||||
subtle.ConstantTimeCompare([]byte(p), []byte(password)) != 1 {
|
||||
log.Printf("unauthorized request from %s", r.RemoteAddr)
|
||||
w.Header().Set("WWW-Authenticate", `Basic realm="pz8-relay"`)
|
||||
http.Error(w, "unauthorized", http.StatusUnauthorized)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user