diff --git a/caddyhttp/rewrite/setup.go b/caddyhttp/rewrite/setup.go index b19dd2f4..17d55659 100644 --- a/caddyhttp/rewrite/setup.go +++ b/caddyhttp/rewrite/setup.go @@ -92,6 +92,7 @@ func rewriteParse(c *caddy.Controller) ([]Rule, error) { } default: if httpserver.IfMatcherKeyword(c.Val()) { + c.RemainingArgs() continue block } return nil, c.ArgErr() diff --git a/caddyhttp/rewrite/setup_test.go b/caddyhttp/rewrite/setup_test.go index 4ee2727b..0dd14939 100644 --- a/caddyhttp/rewrite/setup_test.go +++ b/caddyhttp/rewrite/setup_test.go @@ -179,6 +179,12 @@ func TestRewriteParse(t *testing.T) { }`, true, []Rule{ &ComplexRule{}, }}, + {`rewrite { + if {path} match / + to /to + }`, false, []Rule{ + &ComplexRule{Base: "/", To: "/to"}, + }}, } for i, test := range regexpTests {