aboutsummaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorMatthew Holt <[email protected]>2024-05-10 15:49:34 -0600
committerMatthew Holt <[email protected]>2024-05-10 15:49:34 -0600
commit6dce4934f0ba3bbf4e69273faf6d00db8f4c2852 (patch)
treecea2e32bfefc66a2de3b7b8cfd334e4e8b88ad6b /modules
parent874d0ce8228d70e803a7cba9db8f28bbb0f45fff (diff)
downloadcaddy-6dce4934f0ba3bbf4e69273faf6d00db8f4c2852.tar.gz
caddy-6dce4934f0ba3bbf4e69273faf6d00db8f4c2852.zip
caddyhttp: Alter log message when request is unhandled (close #5182)
Diffstat (limited to 'modules')
-rw-r--r--modules/caddyhttp/caddyhttp.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/caddyhttp/caddyhttp.go b/modules/caddyhttp/caddyhttp.go
index 26b21b541..f42b166cf 100644
--- a/modules/caddyhttp/caddyhttp.go
+++ b/modules/caddyhttp/caddyhttp.go
@@ -76,7 +76,10 @@ type MiddlewareHandler interface {
}
// emptyHandler is used as a no-op handler.
-var emptyHandler Handler = HandlerFunc(func(http.ResponseWriter, *http.Request) error { return nil })
+var emptyHandler Handler = HandlerFunc(func(_ http.ResponseWriter, req *http.Request) error {
+ SetVar(req.Context(), "unhandled", true)
+ return nil
+})
// An implicit suffix middleware that, if reached, sets the StatusCode to the
// error stored in the ErrorCtxKey. This is to prevent situations where the
@@ -120,7 +123,7 @@ type ResponseHandler struct {
Routes RouteList `json:"routes,omitempty"`
}
-// Provision sets up the routse in rh.
+// Provision sets up the routes in rh.
func (rh *ResponseHandler) Provision(ctx caddy.Context) error {
if rh.Routes != nil {
err := rh.Routes.Provision(ctx)