From 39e55072d7d89077caa3baa2680961d56c332947 Mon Sep 17 00:00:00 2001 From: Pedro Nasser Date: Fri, 8 Jul 2016 14:11:15 -0300 Subject: [PATCH] fix rewrite if problem (skip remaining args) --- caddyhttp/rewrite/setup.go | 1 + caddyhttp/rewrite/setup_test.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/caddyhttp/rewrite/setup.go b/caddyhttp/rewrite/setup.go index b19dd2f49..17d55659d 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 4ee2727b4..0dd149390 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 {