@marcel91200 / caddy Mirror · read-only / commits / 6dce4934
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 12, 13:15 UTC

caddyhttp: Alter log message when request is unhandled (close #5182)

Matthew Holt committed May 10, 2024 at 15:49 UTC 6dce4934f0ba3bbf4e69273faf6d00db8f4c2852
1 file changed +5 -2
modules/caddyhttp/caddyhttp.go
+5 -2
@@ -76,7 +76,10 @@ type MiddlewareHandler interface {
76 }
77
78 // emptyHandler is used as a no-op handler.
79 -var emptyHandler Handler = HandlerFunc(func(http.ResponseWriter, *http.Request) error { return nil })
79 +var emptyHandler Handler = HandlerFunc(func(_ http.ResponseWriter, req *http.Request) error {
80 + SetVar(req.Context(), "unhandled", true)
81 + return nil
82 +})
83
84 // An implicit suffix middleware that, if reached, sets the StatusCode to the
85 // error stored in the ErrorCtxKey. This is to prevent situations where the
@@ -120,7 +123,7 @@ type ResponseHandler struct {
123 Routes RouteList `json:"routes,omitempty"`
124 }
125
123 -// Provision sets up the routse in rh.
126 +// Provision sets up the routes in rh.
127 func (rh *ResponseHandler) Provision(ctx caddy.Context) error {
128 if rh.Routes != nil {
129 err := rh.Routes.Provision(ctx)