diff options
author | Francis Lavoie <lavofr@gmail.com> | 2021-09-17 02:52:32 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-17 00:52:32 -0600 |
commit | 907e2d8d3a8ebaf14aa99939c493e56645bc2089 (patch) | |
tree | f5aa4af53cdc9209075c6bc52e1aa0e12c7abc7b /modules/caddyhttp/matchers.go | |
parent | 33c70f418f780f8e9524c73fbf4bbdbdbb9d7500 (diff) |
caddyhttp: Add support for triggering errors from `try_files` (#4346)
* caddyhttp: Add support for triggering errors from `try_files`
* caddyhttp: Use vars instead of placeholders/replacer for matcher errors
* caddyhttp: Add comment for matcher error var key
Diffstat (limited to 'modules/caddyhttp/matchers.go')
-rw-r--r-- | modules/caddyhttp/matchers.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/caddyhttp/matchers.go b/modules/caddyhttp/matchers.go index b452d48..a22a3f1 100644 --- a/modules/caddyhttp/matchers.go +++ b/modules/caddyhttp/matchers.go @@ -987,6 +987,12 @@ var wordRE = regexp.MustCompile(`\w+`) const regexpPlaceholderPrefix = "http.regexp" +// MatcherErrorVarKey is the key used for the variable that +// holds an optional error emitted from a request matcher, +// to short-circuit the handler chain, since matchers cannot +// return errors via the RequestMatcher interface. +const MatcherErrorVarKey = "matchers.error" + // Interface guards var ( _ RequestMatcher = (*MatchHost)(nil) |