From de508582801de669d0c263eacbb2f9214740ae31 Mon Sep 17 00:00:00 2001 From: ari melody Date: Sun, 10 Nov 2024 05:44:45 +0000 Subject: [PATCH] accept HEAD on / (200) --- main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.go b/main.go index 8e8839a..5f2f966 100644 --- a/main.go +++ b/main.go @@ -78,6 +78,11 @@ func createServeMux() *http.ServeMux { mux.Handle("/music/", http.StripPrefix("/music", view.MusicHandler())) mux.Handle("/uploads/", http.StripPrefix("/uploads", staticHandler(filepath.Join(global.Config.DataDirectory, "uploads")))) mux.Handle("/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.Method == http.MethodHead { + w.WriteHeader(http.StatusOK) + return + } + if r.URL.Path == "/" || r.URL.Path == "/index.html" { err := templates.Pages["index"].Execute(w, nil) if err != nil {