accept HEAD on / (200)

This commit is contained in:
ari melody 2024-11-10 05:44:45 +00:00
parent bace6e7fa4
commit de50858280
Signed by: ari
GPG key ID: CF99829C92678188

View file

@ -78,6 +78,11 @@ func createServeMux() *http.ServeMux {
mux.Handle("/music/", http.StripPrefix("/music", view.MusicHandler())) mux.Handle("/music/", http.StripPrefix("/music", view.MusicHandler()))
mux.Handle("/uploads/", http.StripPrefix("/uploads", staticHandler(filepath.Join(global.Config.DataDirectory, "uploads")))) mux.Handle("/uploads/", http.StripPrefix("/uploads", staticHandler(filepath.Join(global.Config.DataDirectory, "uploads"))))
mux.Handle("/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 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" { if r.URL.Path == "/" || r.URL.Path == "/index.html" {
err := templates.Pages["index"].Execute(w, nil) err := templates.Pages["index"].Execute(w, nil)
if err != nil { if err != nil {