diff --git a/config/parse/parsing.go b/config/parse/parsing.go index 430751107..8eb2c12c6 100644 --- a/config/parse/parsing.go +++ b/config/parse/parsing.go @@ -51,6 +51,12 @@ func (p *parser) begin() error { return err } + if p.eof { + // this happens if the Caddyfile consists of only + // a line of addresses and nothing else + return nil + } + err = p.blockContents() if err != nil { return err @@ -113,12 +119,6 @@ func (p *parser) blockContents() error { p.cursor-- } - if p.eof { - // this happens if the Caddyfile consists of only - // a line of addresses and nothing else - return nil - } - err := p.directives() if err != nil { return err