summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/routes.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddyhttp/routes.go')
-rw-r--r--modules/caddyhttp/routes.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/caddyhttp/routes.go b/modules/caddyhttp/routes.go
index ebd763c..7b2871f 100644
--- a/modules/caddyhttp/routes.go
+++ b/modules/caddyhttp/routes.go
@@ -200,6 +200,15 @@ func wrapRoute(route Route) Middleware {
// route must match at least one of the matcher sets
if !route.MatcherSets.AnyMatch(req) {
+ // allow matchers the opportunity to short circuit
+ // the request and trigger the error handling chain
+ err, ok := GetVar(req.Context(), MatcherErrorVarKey).(error)
+ if ok {
+ return err
+ }
+
+ // call the next handler, and skip this one,
+ // since the matcher didn't match
return nextCopy.ServeHTTP(rw, req)
}