diff options
| -rw-r--r-- | modules/caddyhttp/routes.go | 6 | 
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/caddyhttp/routes.go b/modules/caddyhttp/routes.go index 83e6354..ebd763c 100644 --- a/modules/caddyhttp/routes.go +++ b/modules/caddyhttp/routes.go @@ -220,7 +220,11 @@ func wrapRoute(route Route) Middleware {  			// make terminal routes terminate  			if route.Terminal { -				nextCopy = emptyHandler +				if _, ok := req.Context().Value(ErrorCtxKey).(error); ok { +					nextCopy = errorEmptyHandler +				} else { +					nextCopy = emptyHandler +				}  			}  			// compile this route's handler stack  | 
