mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-26 21:53:48 +03:00
caddyhttp: Alter log message when request is unhandled (close #5182)
This commit is contained in:
parent
874d0ce822
commit
6dce4934f0
1 changed files with 5 additions and 2 deletions
|
@ -76,7 +76,10 @@ type MiddlewareHandler interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
// emptyHandler is used as a no-op handler.
|
// 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
|
// An implicit suffix middleware that, if reached, sets the StatusCode to the
|
||||||
// error stored in the ErrorCtxKey. This is to prevent situations where 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"`
|
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 {
|
func (rh *ResponseHandler) Provision(ctx caddy.Context) error {
|
||||||
if rh.Routes != nil {
|
if rh.Routes != nil {
|
||||||
err := rh.Routes.Provision(ctx)
|
err := rh.Routes.Provision(ctx)
|
||||||
|
|
Loading…
Reference in a new issue