diff --git a/plugin/template/setup.go b/plugin/template/setup.go index 9f122277a..33eeb086f 100644 --- a/plugin/template/setup.go +++ b/plugin/template/setup.go @@ -155,10 +155,6 @@ func templateParse(c *caddy.Controller) (handler Handler, err error) { t.regex = append(t.regex, regexp.MustCompile(".*")) } - if len(t.answer) == 0 && len(t.authority) == 0 && t.rcode == dns.RcodeSuccess { - return handler, c.Errf("no answer section for template found: %v", handler) - } - handler.Templates = append(handler.Templates, t) } diff --git a/plugin/template/setup_test.go b/plugin/template/setup_test.go index 64afac32a..f0eb33be1 100644 --- a/plugin/template/setup_test.go +++ b/plugin/template/setup_test.go @@ -36,13 +36,6 @@ func TestSetupParse(t *testing.T) { {`template X`, true}, {`template ANY`, true}, {`template ANY X`, true}, - {`template ANY ANY (?P`, true}, - { - `template ANY ANY { - - }`, - true, - }, { `template ANY ANY .* { notavailable @@ -92,6 +85,13 @@ func TestSetupParse(t *testing.T) { true, }, // examples + {`template ANY ANY (?P`, false}, + { + `template ANY ANY { + + }`, + false, + }, { `template ANY A example.com { match ip-(?P[0-9]*)-(?P[0-9]*)-(?P[0-9]*)-(?P[0-9]*)[.]example[.]com