From 32a2cf51005591b4b86ac05ca920bb0e5d7af16a Mon Sep 17 00:00:00 2001
From: Pascal Bleser
Date: Tue, 21 Oct 2025 10:42:33 +0200
Subject: [PATCH] groupware: add headers Unmatched-Path and Unsupported-Method
to make development of the web UI easier
---
services/groupware/pkg/groupware/groupware_framework.go | 2 ++
1 file changed, 2 insertions(+)
diff --git a/services/groupware/pkg/groupware/groupware_framework.go b/services/groupware/pkg/groupware/groupware_framework.go
index 23e00800d1..1bd4bc9695 100644
--- a/services/groupware/pkg/groupware/groupware_framework.go
+++ b/services/groupware/pkg/groupware/groupware_framework.go
@@ -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)
}