Skip to content

Commit

Permalink
minor fixes of matchers names
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammed90 committed Feb 9, 2020
1 parent 60be950 commit b2b5f1c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions if.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,15 @@ func calculateIfMatcher(dir Directive) (caddy.ModuleMap, []caddyconfig.Warning)
// as wildcard matcher.
// https://github.com/caddyserver/caddy/blob/271b5af14894a8cca5fc6aa6f1c17823a1fb5ff3/modules/caddyhttp/server.go#L139
routeMatcher = caddy.ModuleMap{
"var_regexp": caddyconfig.JSON(caddyhttp.VarsMatcher{getCaddyVar(loperand): roperand}, &warns),
"vars": caddyconfig.JSON(caddyhttp.VarsMatcher{getCaddyVar(loperand): roperand}, &warns),
}
case "~", "!~", "~*", "!~*": // regexps
pattern := roperand
if strings.HasSuffix(pattern, "*") {
pattern = "(?i)" + pattern // case-insensitive matching
}
routeMatcher = caddy.ModuleMap{
"var_regexp": caddyconfig.JSON(caddyhttp.MatchVarRE{
"vars_regexp": caddyconfig.JSON(caddyhttp.MatchVarsRE{
getCaddyVar(loperand): &caddyhttp.MatchRegexp{
Pattern: pattern,
},
Expand Down

0 comments on commit b2b5f1c

Please sign in to comment.