diff --git a/caddy/setup/gzip.go b/caddy/setup/gzip.go index 40c81252..7d09fe01 100644 --- a/caddy/setup/gzip.go +++ b/caddy/setup/gzip.go @@ -47,7 +47,7 @@ func gzipParse(c *Controller) ([]gzip.Config, error) { return configs, c.ArgErr() } for _, e := range exts { - if !strings.HasPrefix(e, ".") && e != gzip.ExtWildCard { + if !strings.HasPrefix(e, ".") && e != gzip.ExtWildCard && e != "" { return configs, fmt.Errorf(`gzip: invalid extension "%v" (must start with dot)`, e) } extFilter.Exts.Add(e) diff --git a/caddy/setup/gzip_test.go b/caddy/setup/gzip_test.go index 36eeb0ae..4c24ab0a 100644 --- a/caddy/setup/gzip_test.go +++ b/caddy/setup/gzip_test.go @@ -50,6 +50,9 @@ func TestGzip(t *testing.T) { level 1 } gzip`, false}, + {`gzip { + ext "" + }`, false}, {`gzip { not /file ext .html level 1