From 42ddb1b77d915786d2e9f7f9823c3d853a1280d9 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 2 Sep 2018 21:48:12 +0000 Subject: [PATCH] Add querylog --- main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 9437d84..765ae17 100644 --- a/main.go +++ b/main.go @@ -29,6 +29,8 @@ func init() { func main() { r := mux.NewRouter() r.Use(BasicAuth) + r.Use(QueryLog) + r.PathPrefix("/").Handler(http.StripPrefix("/", enhancedfileserver.FileServer(http.Dir("./")))) a := fmt.Sprintf("%s:%d", c.Listen, c.Port) @@ -41,7 +43,7 @@ func BasicAuth(next http.Handler) http.Handler { if c.Username != "" && c.Password != "" { user, pass, ok := r.BasicAuth() if !ok || user != c.Username || pass != c.Password { - w.Header().Set("WWW-Authenticate", `Basic realm="mydomain"`) + w.Header().Set("WWW-Authenticate", `Basic realm="mydomains"`) http.Error(w, "Unauthorized", http.StatusUnauthorized) }