groupware: add headers Unmatched-Path and Unsupported-Method to make

development of the web UI easier
This commit is contained in:
Pascal Bleser
2025-10-21 10:42:33 +02:00
parent fa6b695f24
commit 32a2cf5100

View File

@@ -682,6 +682,7 @@ func (g *Groupware) NotFound(w http.ResponseWriter, r *http.Request) {
method := log.SafeString(r.Method)
level.Str(logPath, path).Str(logMethod, method).Int(logErrorStatus, http.StatusNotFound).Msgf("unmatched path: '%v'", path)
}
w.Header().Add("Unmatched-Path", r.URL.Path) // TODO possibly remove this in production for security reasons?
w.WriteHeader(http.StatusNotFound)
}
@@ -692,5 +693,6 @@ func (g *Groupware) MethodNotAllowed(w http.ResponseWriter, r *http.Request) {
method := log.SafeString(r.Method)
level.Str(logPath, path).Str(logMethod, method).Int(logErrorStatus, http.StatusNotFound).Msgf("method not allowed: '%v'", method)
}
w.Header().Add("Unsupported-Method", r.Method) // TODO possibly remove this in production for security reasons?
w.WriteHeader(http.StatusNotFound)
}