summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/routes.go
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2022-07-28 17:19:48 -0400
committerGitHub <noreply@github.com>2022-07-28 15:19:48 -0600
commitff2ba6de8a312813140b5db24f14a407e98f4509 (patch)
tree8724d2e8921c8ba28bd6682f17537eb84f6514b5 /modules/caddyhttp/routes.go
parent4fced0b6e15429dd51e6edc2c244f7af068ecf84 (diff)
caddyhttp: Clear out matcher error immediately after grabbing it (#4916)
Co-authored-by: Matthew Holt <mholt@users.noreply.github.com>
Diffstat (limited to 'modules/caddyhttp/routes.go')
-rw-r--r--modules/caddyhttp/routes.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/caddyhttp/routes.go b/modules/caddyhttp/routes.go
index 7b2871f..b8771db 100644
--- a/modules/caddyhttp/routes.go
+++ b/modules/caddyhttp/routes.go
@@ -204,6 +204,10 @@ func wrapRoute(route Route) Middleware {
// the request and trigger the error handling chain
err, ok := GetVar(req.Context(), MatcherErrorVarKey).(error)
if ok {
+ // clear out the error from context, otherwise
+ // it will cascade to the error routes (#4916)
+ SetVar(req.Context(), MatcherErrorVarKey, nil)
+ // return the matcher's error
return err
}